把字符串中的和字典中的字符串的ID相对应,之后以|区分,存入字符串
//车长
NSArray *strArr = [self.conductorLbl.text componentsSeparatedByString:@" "];// 以空格分割成数组,依次读取数组中的元素
NSMutableArray * arrayKey = [[NSMutableArray alloc]init];
for (NSString * str in strArr) {
NSArray *keys = [self.conductorDic allKeys];
NSString *theKey = nil;
for(NSString *key in keys){
NSString *value = self.conductorDic[key];
if([value isEqualToString:str]){
theKey = key;
[arrayKey addObject:theKey];
break;//好了,现在你得到你的key了。
}
}
}
NSString *cheC1 = @"";
for(NSString *str22 in arrayKey){
cheC1 = [cheC1 stringByAppendingFormat:@"%@|",str22];
}//车长cheC
NSString *cheC = [cheC1 substringToIndex:[cheC1 length] - 1];
网友评论