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

前端 未结 6 2241
北荒
北荒 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:37

    stringByTrimmingCharactersInSet removes characters from the beginning and end of your string, not from any place in it

    For your purpose use stringByReplacingOccurrencesOfString:withString: method as others pointed.

提交回复
热议问题