【发布时间】:2012-03-26 11:31:42
【问题描述】:
我想删除我的 NSString 的一部分。
我有这个:@"Test Hello http://www.google.fr wolrd"
我想输出:@"Test Hello other world"
一些想法? 谢谢 :)
【问题讨论】:
-
[yourString stringByReplacingOccurancesOfString:@"http://google.fr" withString:@"other"]; -
别忘了
[yourString stringByReplacingOccurancesOfString:@"wolrd" withString:@"world"];;-) -
我的字符串可以是google.fr,但也可以是facebook.fr 或twitter.fr 之类的其他字符串...
-
字符串总是host.tld吗?删除任意的“whatever”字符串会很困难。
-
我只需要删除字符串中的 url。
标签: iphone xcode string nsstring