How to detect if certain characters are at the end of an NSString?
Posted
by Sheehan Alam
on Stack Overflow
See other posts from Stack Overflow
or by Sheehan Alam
Published on 2010-04-06T19:25:47Z
Indexed on
2010/04/06
19:33 UTC
Read the original article
Hit count: 387
Let's assume I can have the following strings:
"hey @john..."
"@john, hello"
"@john(hello)"
I am tokenizing the string to get every word separated by a space:
[myString componentsSeparatedByString:@" "];
My array of tokens now contain:
@john...
@john,
@john(hello)
For these cases. How can I make sure only @john is tokenized, while retaining the trailing characters:
...
,
(hello)
Note: I would like to be able to handle all cases of characters at the end of a string. The above are just 3 examples.
© Stack Overflow or respective owner