bluetooth99 2013-01-04 05:23 采纳率: 0%
浏览 5845
已采纳

动态添加字符串到NSString中

NSString的内容来自一个URL,我希望添加一些字符串到里面。而且这个NSString会实时改变。

比如:

获取的数据是:" hi mac this is ios"然后字符串就会改变为:" hi ios this mac" or hi this is mac ios"

mac后面就加上hello:变成这样:

" hi mac hello this is ios"
" hi ios this mac hello"
"hi this is mac hello ios"

该如何实现?

  • 写回答

2条回答

  • MrsSeven7 2013-01-04 08:22
    关注
    string = [string stringByReplacingOccurrencesOfString:@"Mac" withString:@"Mac Hello"];
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?