读书人

掏出字符串中的指定内容

发布时间: 2012-07-30 16:19:05 作者: rapoo

取出字符串中的指定内容

- (NSString *)CopyPartTextToString : (NSString *)SourceData FirstPlaceIndex : (NSInteger) FirstPlaceIndexLastPlaceIndex : (NSInteger) LastPlaceIndex {if (FirstPlaceIndex < 1) FirstPlaceIndex = 1;if (LastPlaceIndex > [SourceData length]) LastPlaceIndex = [SourceData length];if (FirstPlaceIndex > LastPlaceIndex) return nil;NSRange range;range.location = FirstPlaceIndex - 1;range.length = LastPlaceIndex - FirstPlaceIndex + 1;return [SourceData substringWithRange:range];}

?

读书人网 >移动开发

热点推荐