标签:
1 // 1.NSArray 转换成 NSMutableArray 2 NSArray *array = @[@"one", @"two", @"three"]; 3 NSMutableArray *muArray = [NSMutableArrayarrayWithArray:array]; 4 NSLog(@"muArray = %@", muArray); 5 6 7 // 2.NSDictionary 转换成 NSMutableDictionary 8 NSDictionary *dic = @{@"one":@"1", @"two":@"2", @"three":@"3"}; 9 NSMutableDictionary *muDic = [NSMutableDictionarydictionaryWithDictionary:dic]; 10 NSLog(@"muDic = %@", muDic); 11 12 // 3.NSArray -> NSSet -> NSMutableSet 13 NSSet *set = [NSSetsetWithArray:array]; 14 NSMutableSet *muSet = [NSMutableSetsetWithSet:set]; 15 NSLog(@"muSet = %@", muSet); 16 17 // 4.NSDcitionary -> NSArray 18 NSArray *allKeys = [dic allKeys]; 19 NSLog(@"allKeys = %@", allKeys); 20 NSArray *allValues = [dic allValues]; 21 NSLog(@"allValues = %@", allValues); 22 23 // 5.NSString -> NSArray 24 NSString *str = @"www.baidu.com"; 25 NSArray *array2 = [str componentsSeparatedByString:@"."]; 26 NSLog(@"array2 = %@", array2);
[OC Foundation框架 - 21] NSSet集合 & 集合之间的转换
标签:
原文地址:http://www.cnblogs.com/wvqusrtg/p/4515496.html