标签:foundation框架 objective-c 存储对象 基本数据类型 集合
<pre name="code" class="objc">int main(int argc, const char * argv[]) { @autoreleasepool { // 4 NSArray -> NSSet NSArray * array = @[@"one",@"two",@"three"]; NSSet * set = [NSSet setWithArray:array]; NSLog(@"%@",set); // 5 NSDictionary -> NSArray NSDictionary * dic = @{ @"name":@"Jack", @"age":@"18", @"ID":@"1001" }; NSArray * keysArray = [dic allKeys]; NSArray * valuesArray = [dic allValues]; //6 字符串转换成数组 // 创建字符串 NSString * str = @"I am studying "; // 传入字符参数分割字符串 NSArray * arrStr = [str componentsSeparatedByString:@"am"]; NSLog(@"arrStr %@",arrStr); } return 0; }
int main(int argc, const char * argv[]) { @autoreleasepool { NSMutableSet * set = [[NSMutableSet alloc] initWithObjects:@"one",@"two", nil]; NSLog(@"%@",set); // 增加值 [set addObject:@"three"]; NSLog(@"%@",set); // 删除值 [set removeObject:@"two"]; NSLog(@"%@",set); // 删除所有 [set removeAllObjects]; NSLog(@"%@",set); } return 0; }
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:foundation框架 objective-c 存储对象 基本数据类型 集合
原文地址:http://blog.csdn.net/u012701023/article/details/47079537