宽容他人,放过自己。

中间加,号字符串的快速创建

Posted on By anchoriteFili

NSString *str = @"";
    int count = 10;
    for (int i = 0; i < count; i ++) {
        if (i+1 == count) {
            str = [str stringByAppendingString:[NSString stringWithFormat:@"%d",i]];
        } else {
            str = [str stringByAppendingString:[NSString stringWithFormat:@"%d,",i]];
        }
    }
    NSLog(@"str ======= %@",str);