修剪数组中的nsstring?不仅仅是空白

时间:2012-08-20 12:12:10

标签: objective-c nsstring nsarray

我有一个包含这些元素的数组

    deviceType = iOS,
    email = "test@test.se",
    lastname = Testsson,
    name = Testar,
    password = 1943B8B39CA8DF2919FAFF021E0ACA98,
    picture = <74657374 40746573 742e7365>,
    timeCreated = "2012-07-17 13:32:36 +0000",
    timeUpdated = "1999-11-30 00:00:00 +0000",
    userID = 13,

我想删除等号前的所有内容并将其存储在新数组中。有没有快速而好的方法来做到这一点?

1 个答案:

答案 0 :(得分:0)

这样的事情怎么样:

NSMutableArray * keys = [NSMutableArray array];
for (NSString * element in yourAarray) {
    NSArray * components = [element componentsSeparatedByString: @" = "];
    [keys addObject: components[0]]
}