OC增删改查

时间:2018-12-07 05:10:26
【文件属性】:

文件名称:OC增删改查

文件大小:88KB

文件格式:DOCX

更新时间:2018-12-07 05:10:26

oc

NSString *str=@"fsdggfhjtyhdrfsdh"; //单个删除 NSString *str1=[str substringFromIndex:1]; NSLog(@"%@",str1); //选择删除 NSString *str2=[str substringWithRange:NSMakeRange(0, 3)]; NSLog(@"%@",str2); //添加 NSString *str3=[str1 stringByAppendingString:str2]; NSLog(@"%@",str3); //修改 NSString *str4=[str stringByReplacingOccurrencesOfString:@"sdgg" withString:@""]; NSLog(@"%@",str4); NSMutableString *sr=[NSMutableString stringWithFormat:@"%@",@"sdfdgdfg"]; //增加 [sr appendFormat:@"ad"]; NSLog(@"%@",sr); //增加 [sr appendFormat:@"%@",@"ad"]; NSLog(@"%@",sr); //删除 [sr deleteCharactersInRange:NSMakeRange(0,3)]; NSLog(@"%@",sr); //插入 [sr insertString:@"ddddd" atIndex:4]; NSLog(@"%@",sr); //修改 [sr replaceCharactersInRange:NSMakeRange(0,4) withString:@""]; NSLog(@"%@",sr);


网友评论

  • 什么鬼?就一个doc?