- #import <Foundation/Foundation.h>
- int main()
- {
- NSString *str = @"iphoneAndroid";
- NSLog(@"修改前的字符串str的内容:%@",str);
-
- NSMutableString *mtstr= str.mutableCopy;
-
- NSRange r={6,7};
-
- [mtstr deleteCharactersInRange:r];
-
- NSLog(@"修改后的临时字符串:%@",mtstr);
-
- str = mtstr;
- NSLog(@"最终字符串str的内容:%@",str);
-
- return 0;
- }
复制代码 |