将项添加到不显示字符的字符串

时间:2010-10-07 12:46:01

标签: iphone objective-c nsstring

    for (NSString *item in items) {
        NSString *ref = [item stringByMatching:myregex1 capture:2];
        NSString *value = [item stringByMatching:myregex1 capture:3];
        NSLog(@"%@ : %@", ref, value);
        AllOrderItems = [AllOrderItems stringByAppendingFormat:(@"%@: %@ \r\n", ref, value)];       

    }

AllOrderItems没有显示:或者新行(\ r \ n)只显示参考号和&值字符串?

请帮忙

由于

1 个答案:

答案 0 :(得分:1)

删除格式周围的括号:

AllOrderItems = [AllOrderItems stringByAppendingFormat:@"%@: %@ \r\n", ref, value];