删除" "来自NSMutableDictionary中的键字符串

时间:2016-12-28 09:03:06

标签: ios nsmutabledictionary

这是我的字典:

Birthdate = "01-01-0001";
CareerField = 3;
Gender = 2;
"Interests[0].UserProfileId" = 19594;
"Interests[0].UserSurveyId" = 1;
SocialStatus = 2;
Studies = 3;

但是我希望兴趣键没有""。就像那样:

Birthdate = "01-01-0001";
CareerField = 3;
Gender = 2;
Interests[0].UserProfileId = 19594;
Interests[0].UserSurveyId = 1;
SocialStatus = 2;
Studies = 3;

更新: 利益我必须像阵列一样发送它们。

[dict setObject:self.birthdayDate forKey:@"Birthdate"]
[dict setObject:@(self.occupationPickerRow + 1) forKey:@"CareerField"];

for (int i = 0; i < [interestsArray count]; i++) {
    NSString *stringSurveyId = [NSString stringWithFormat:@"%@%d%@", @"Interests[", indexCount, @"].UserSurveyId"];
    NSString *stringUserProfileId = [NSString stringWithFormat:@"%@%d%@", @"Interests[", indexCount, @"].UserProfileId"];

    [dict setObject:[interestsArray objectAtIndex:i] forKey:stringSurveyId];
    [dict setObject:@([[[MZEngine sharedInstance] currentUserModel] userId]) forKey:stringUserProfileId];
    indexCount++;
}

0 个答案:

没有答案