Replacing one character in a string in Objective-C

前端 未结 4 836
故里飘歌
故里飘歌 2020-11-30 07:22

Hoping somebody can help me out - I would like to replace a certain character in a string and am wondering what is the best way to do this?

I know the location of th

4条回答
  •  萌比男神i
    2020-11-30 07:50

    NSString *str = @"123*abc";
    str = [str stringByReplacingOccurrencesOfString:@"*" withString:@""];
    //str now 123abc
    

提交回复
热议问题