TA的每日心情 | 汗 2024-10-15 10:05 |
---|
签到天数: 372 天 [LV.9]以坛为家II
|
楼主 |
发表于 2014-1-8 20:29:31
|
显示全部楼层
XCode正式代码:- //
- // main.m
- // NSMutableString
- //
- // Created by yusian on 14-1-8.
- // Copyright (c) 2014年 yusian. All rights reserved.
- //
- #import <Foundation/Foundation.h>
- int main(int argc, const char * argv[])
- {
- @autoreleasepool {
-
- NSMutableString * str = [[NSMutableString alloc] initWithString:@"Hello str!"];
- NSLog(@"%@",str);
- [str release];
-
- NSMutableString * str1 = [[NSMutableString alloc] init];
- [str1 setString:@"Hello NSMutableString Message!"];
- [str1 setString:@"Hello World!"];
- NSLog(@"%@",str1);
- [str1 release];
-
- NSMutableString * str2 = [[NSMutableString alloc] init];
- [str2 appendString:@"NS"];
- [str2 appendString:@"String"];
- [str2 appendFormat:@"%c",'!'];
- NSLog(@"%@",str2);
-
- [str2 insertString:@"Mutable" atIndex:2];
- NSLog(@"%@",str2);
-
- [str2 deleteCharactersInRange:NSMakeRange(2, 7)];
- NSLog(@"%@",str2);
- [str2 release];
-
- }
- return 0;
- }
复制代码 |
|