How to detect if certain characters are at the end of an NSString?
- by Sheehan Alam
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.