dictionary
遍历字典
NSLog(@"***遍历字典myClassDict如下:");for (id key in myClassDict)
{
NSLog(@"key: %@ ,value: %@",key,[myClassDict objectForKey:key]);
}
[_surveyAnswers1 setObject:myArrayAnswers1 forKey:@"FirstKey"];
for (NSString *key in [cacheDict allKeys]) {}
array
快速创建array
//NSMutableArray *array = [NSMutableArray arrayWithObjects: @"One",@"Two",@"Three",nil];
[_list addObjectsFromArray:[indexlist copy]];
/*-------------数组枚举---------------*/
//- (NSEnumerator *)objectEnumerator;从前向后
//NSMutableArray *array = [NSMutableArray arrayWithObjects:
@"One",@"Two",@"Three",nil];
NSEnumerator *enumerator;
enumerator = [array objectEnumerator];
id thingie;
while (thingie = [enumerator nextObject]) {
NSLog(@"thingie:%@",thingie);
}
//- (NSEnumerator *)reverseObjectEnumerator;从后向前
//NSMutableArray *array = [NSMutableArray arrayWithObjects:
@"One",@"Two",@"Three",nil];
NSEnumerator *enumerator;
enumerator = [array reverseObjectEnumerator];
id object;
while (object = [enumerator nextObject]) {
NSLog(@"object:%@",object);
}
//- (NSEnumerator *)objectEnumerator;从前向后
//NSMutableArray *array = [NSMutableArray arrayWithObjects:
@"One",@"Two",@"Three",nil];
NSEnumerator *enumerator;
enumerator = [array objectEnumerator];
id thingie;
while (thingie = [enumerator nextObject]) {
NSLog(@"thingie:%@",thingie);
}
//- (NSEnumerator *)reverseObjectEnumerator;从后向前
//NSMutableArray *array = [NSMutableArray arrayWithObjects:
@"One",@"Two",@"Three",nil];
NSEnumerator *enumerator;
enumerator = [array reverseObjectEnumerator];
id object;
while (object = [enumerator nextObject]) {
NSLog(@"object:%@",object);
}
NSString
rang.location 指向的是 @"//" 的头一个字符
NSRange range;
range = [url rangeOfString:@"//"];
if (range.length > 0) {
url = [url substringFromIndex:range.location + range.length];
}
range = [url rangeOfString:@"//"];
if (range.length > 0) {
url = [url substringFromIndex:range.location + range.length];
}
从 // 之后截取
range = [url rangeOfString:@"/"];
if (range.length > 0) {
url = [url substringFromIndex:range.location + 1];
}
if (range.length > 0) {
url = [url substringFromIndex:range.location + 1];
}
截取到 # ,不包含#
range = [url rangeOfString:@"#"];
if (range.length > 0 && range.location > 0) {
url = [url substringToIndex:range.location];
range = [url rangeOfString:@"#"];
if (range.length > 0 && range.location > 0) {
url = [url substringToIndex:range.location];
}
modulename = [NSStringstringWithUTF8String:(*itStr).c_str()];
NSString* welcomeInfo =[@"欢迎回来 "stringByAppendingString:nickName];
NSString *servantCmd = [NSString stringWithFormat:@"wnsxms.%@",@"getcommandlist"];