问题
in an SSRS report textbox, i have this =Fields!FullName.Value
which displays a customers Full name (FirstName and LastName). What i want to do is to only display their FirstName. I basically want to to remove every character that comes after the first white space
E.G if the value returned is Tom Ndovu, i want to Dispaly Tom.
if its Bill M Chark, i want to only display Bill.
回答1:
This instruction get the string from the start to the first occurence the character " " (space)
=Mid(Fields!FullName.Value,1, Instr(Fields!FullName.Value, " "))
If the white space is not always present you should check the value returned from Instr using something like this
=Mid(Fields!FullName.Value ,1,
IIF(Instr(Fields!FullName.Value, " ") > 0 ,Instr(Fields!FullName.Value, " "),
LEN(Fields!FullName.Value)))
来源:https://stackoverflow.com/questions/5819335/remove-all-characters-after-first-white-space-in-ssrs-2005