IOS字符串的处理例子

 NSMutableString *string = [NSMutableString stringWithFormat:@"age is %i.",28];

    [string setString:@"123"];

    [string appendString:@"456"];

    [string appendFormat:@"age is %i.",29];

    NSLog(@"afterAppend:%@",string);

    

    [string setString:@"123456"];

    NSRange range =[string rangeOfString:@"345"];

    [string replaceCharactersInRange:range  withString:@"abc"];

    NSLog(@"afterreplace:%@",string);

你可能感兴趣的:(ios)