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...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
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...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.