例如,文本为:
my name is angie merkel and Im stupid!
我想从字符串中获取angie merkel
。
我该怎么做呢?我的头要爆炸了..。我不能修剪这个字符串,因为它是一个变量
(来自用户的ChatBot文本)
发布于 2011-09-26 16:41:58
如果字符串的格式始终是‘`my name is and I’m format!‘,则可以执行以下操作:
NSString *name = [[startingString stringByReplacingOccurrencesOfString:@"my name is "
withString:@""]
stringByReplacingOccurrencesOfString:@" and Im stupid!"
withString:@""];
https://stackoverflow.com/questions/7558284
复制相似问题