下面的代碼是用來替換部分字符串,對一些普通字符,比如字母,就運行正常。但是如果是這樣的符號 "•",就替換不了。
應該怎麼辦?
[myString stringByReplacingOccurrencesOfString:@"•" withString:@"<BULLET_POINT>"];
完全的可以的啊:
NSString *myString = @"Hello, World • good morning";
NSLog(@"original string: %@", myString);
NSString *replaceString = [myString stringByReplacingOccurrencesOfString:@"•" withString:@"測試"];
NSLog(@"replaced string: %@", replaceString);