标签: iphone objective-c cocoa
NSString *foo = @" x "; NSRange r = [foo rangeOfCharacterFromSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; NSLog(@"foo range = %d,%d",r.location, r.length);
结果为“foo range = 0,1”
所以它会返回长度> 1?
答案 0 :(得分:6)
请参阅the documentation for that method和for the more general method it's implemented with。