//1.NSArray 转换成 NSMutableArray NSArray * array = @[@"one",@"two",@"three"]; NSMutableArray * muArray = [NSMutableArray arrayWithArray:array]; NSLog(@"muarray %@",muArray); //2.NSDictonary 转换成 NSMutableDictionary NSDictionary * dic = @{@"one":@"1",@"two":@"2"}; NSMutableDictionary * muDic = [NSMutableDictionary dictionaryWithDictionary:dic]; NSLog(@"mudic %@ ",muDic); //3.NSset 转换成 NSMutableSet NSSet * set = [[NSSet alloc] initWithObjects:@"one",@"two", nil]; NSMutableSet *muSet = [NSMutableSet setWithSet:set]; NSLog(@"muSet %@",muSet); //4.NSArray 转换成NSSet NSMutableSet * muSet2 = [NSMutableSet setWithArray:array]; NSLog(@"muSet2 %@",muSet2); //5.NSDictionary 转化成NSArray NSArray * allkeys = [dic allKeys]; NSLog(@"allkeys %@",allkeys); NSArray * allValues = [dic allValues]; NSLog(@"allValues %@",allValues); //6.字符串转换成数组 NSString * str = @"www.itacast.cn"; NSArray * strArray = [str componentsSeparatedByString:@"."]; NSLog(@"strArray %@",strArray);
时间: 2024-10-05 23:47:36