赞
踩
NSRange NSMakeRange (
NSUInteger loc,
NSUInteger len
);
Return Value An NSRange
with location location and length length.
返回值一个NSRange与地点位置和长度的长度。
NSString * NSStringFromRange (
NSRange range
);
//查找指定字符串的范围 NSRange结构体重新命名得到的 返回值为:range.location 和range.length 只查找有没有 而不管有几个
NSRange range = [str4 rangeOfString:@"http"];
if (range.length == 0) {
NSLog(@"没有相关的字符串");
}else{
//将NSRange 结构体类型变量直接转换成字符串对象输出
/* typedef struct _NSRange {
NSUInteger location;
NSUInteger length;
} NSRange;
*/
NSLog(@"%@",NSStringFromRange(range));//将结构体以字符串对象的形式输出
//NSLog(@"locatio = %lu,length = %lu",range.location,range.length);等价于上面的方法
}
9.-substringFromIndex;
These constants are used to indicate how items in a request are ordered.
enum {
NSOrderedAscending = -1,
NSOrderedSame,
NSOrderedDescending
};
typedef NSInteger NSComparisonResult;
compare:options:range:
with no options and the receiver’s full extent as the range.float
.NSInteger
value of the receiver’s text.Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。