stringByTrimmingCharactersInSet: is not removing characters in the middle of the string

前端 未结 6 2234
北荒
北荒 2020-12-15 06:23

I want to remove \"#\" from my string.

I have tried

 NSString *abc = [@\"A#BCD#D\" stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWith         


        
6条回答
  •  再見小時候
    2020-12-15 06:40

    Refer to the Apple Documentation about: stringByReplacingOccurrencesOfString: method in NSString

    NSString *str1=[str stringByReplacingOccurrencesOfString:@"#" withString:@""];
    

    Hope this helps.

提交回复
热议问题