How to get a string after another string in ObjectiveC?
For example, the text is:
my na开发者_StackOverflow中文版me is angie merkel and Im stupid!
I'd like to get the angie merkel
from the string.
How can i do this? My head is going to explode... i can't trim this string because it's a variable
(text from the user for a ChatBot)If the string always has the format `my name is and Im stupid!', you can do the following:
NSString *name = [[startingString stringByReplacingOccurrencesOfString:@"my name is "
withString:@""]
stringByReplacingOccurrencesOfString:@" and Im stupid!"
withString:@""];
精彩评论