我必须使用NSMutableSet
来存储我的字符串对象。我想以正确的顺序存储它们,例如从最小到最大的数字:
1
2
3
4
如果这样做:
NSMutableSet *set = [[NSMutableSet alloc] init];
[set addObject:[NSString stringWithFormat:@"1"]];
[set addObject:[NSString stringWithFormat:@"2"]];
[set addObject:[NSString stringWithFormat:@"3"]];
[set addObject:[NSString stringWithFormat:@"4"]];
NSLog(@"set is %@",set);
[set release];
我没有得到我想要的,而是这个:
set is {(
3,
1,
4,
2
)}
所以我想我需要对它们进行排序以获得想要的结果?但我真的找不到任何例子。
也许有人可以帮助我吗?
谢谢。
编辑:
我不能使用其他。只是NSMutableSet
或NSSet