substringFromIndex:从Index开始截取到最后
substringToIndex:从最前头一直截取到Index
substringFromIndex 和 substringToIndex用法,有需要的朋友可以参考下。
NSString *testsubstringToorFromIndex = @"test1234";
NSString *fromIndexstring = [testsubstringToorFromIndex substringFromIndex:2];
NSString *toIndexstring = [testsubstringToorFromIndex substringToIndex:2];
NSLog(@"subtringfromindex is %@",fromIndexstring);
NSLog(@"subtringToindex is %@",toIndexstring);
输出结果
2014-11-29 06:23:59.634 sdktest[587:11024] subtringfromindex is st1234
2014-11-29 06:23:59.634 sdktest[587:11024] subtringToindex is te
网友评论