开发者

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:@""];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜