Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi, if a string comes in as Bob Johnson, how can i print out just Bob?
Bob Johnson
Bob
Thanks
Ps, have tried such like:
hisName.Split(' ').First()
But getting an error; 'System.Array' does not contain a definition for 'First'
'System.Array' does not contain a definition for 'First'
Maybe try hisName.Split(' ')[0] instead then? =)
Or I'm guessing you need to make it a list or some such first :)
Cheers mate that worked.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Get first word of a string
Hi, if a string comes in as
Bob Johnson
, how can i print out justBob
?Thanks
Ps, have tried such like:
But getting an error;
'System.Array' does not contain a definition for 'First'
Maybe try hisName.Split(' ')[0] instead then? =)
Or I'm guessing you need to make it a list or some such first :)
Cheers mate that worked.
is working on a reply...