NSRange(location, length):
eg:
NSRange r1 = {2,5}; NSRange r2 = {.location=2, .length=5}; NSRange r3 = NSMakeRange(2,5);//开发用 NSRange r4 = [@"hello kitty", rangeOfString:@"kit"];//r4={6,3} NSRange r5 = [@"hello kitty", rangeOfString:@"java"];//r5={NSNotFound,0}
ps: NSNotFound == -1;
NSString:它的实例可以包含任意的Unicode字符
eg:
NSString *name = @"大老虎";
方法:
- (NSUInteger)length;
- (BOOL)isEqualToString:(NSString *)other;
- (NSString *)uppercaseString;
- (NSRange)rangeOfString:(NSString *)aString
NSArray:
方法:
- (NSUInteger)count;
for循环array用到它,并且可以在循环中添加或删除数组对象;在fast enumeration中会自动计算总数,但是不能有添加和删除操作:
for (type *object in collection) { statements }