首页 > 代码库 > IOS字符串的处理例子

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字符串的处理例子