NSString類別裡,總共有三種切字串的方法
1. - (NSString *)substringFromIndex:(NSUInteger)anIndex
2. - (NSString *)substringToIndex:(NSUInteger)anIndex
3. - (NSString *)substringWithRange:(NSRange)aRange
==================
NSString *str = @"1234567890";
NSLog(@"Original String: %@", str);
NSLog(@"substringFromIndex: 5 ==> %@", [str substringFromIndex:5]);
NSLog(@"substringToIndex: 5 ==> %@", [str substringToIndex:5]);
NSLog(@"substringWithRange: from 7, length 3 ==> %@", [str substringWithRange:NSMakeRange(7, 3)]);
[OC] 如何切字串
2016-03-07