前言
一些诡异的问题,目前毫无思路,先放着可能哪一天以后的自己就可以解答。也欢迎交流指点下。
问题列表
stringByReplacingOccurrencesOfString去除空格失败
30th,August,2016
为什么打印stripSpaceText存在空格,而将newText赋给textStr后,再进行去除就可以了。
UITextRange *selectedRange = [textView markedTextRange];
NSString *newText = [textView textInRange:selectedRange];// print: "S s"
NSString *stripSpaceText = [newText stringByReplacingOccurrencesOfString:@" " withString:@""];// print "S s"
NSString *textStr = newText;
NSString *resultStr = [textStr stringByReplacingOccurrencesOfString:@" " withString:@""];// print "Ss" 无空格