标签:objective-c ios开发 ios 文件写入 foundation框架
#import <Foundation/Foundation.h> //创建可变字符串 int main(int argc, const char * argv[]) { @autoreleasepool { NSString * str1 = @"baidu"; NSMutableString * str =[[NSMutableString alloc]initWithString:@"baidu"]; NSLog(@"%p %p",str1,str); NSMutableString * str2 = [[NSMutableString alloc]init]; [str setString:@"baidu"]; NSLog(@"%@",str2); //在字符串末尾追加字符串 [str2 appendString:@"百度"]; NSLog(@"%@",str2); //在 index 处插入字符串 [str2 insertString:@"baidu" atIndex:0]; //[str2 inser] NSLog(@"%@",str2); NSRange range = {3,2}; [str2 deleteCharactersInRange:range]; NSLog(@"%@",str2); //insert //set2 baidu.com [str2 setString:@"baidu"]; NSUInteger count = [str2 length]; [str2 insertString:@".com" atIndex:count]; NSLog(@"%@ str2:",str2); } return 0; }
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:objective-c ios开发 ios 文件写入 foundation框架
原文地址:http://blog.csdn.net/u012701023/article/details/47052721