我们的生活有这么多的障碍,真他妈的有意思,这种逻辑就叫做黑色幽默。

Objective-C 2.0学习笔记之NSMutableString

#import <Foundation/Foundation.h>
 
int main (int argc, const char * argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
	//+ (id) stringWithFormat: (NSString *) format,...;
    NSMutableString *friends=[NSMutableString stringWithCapacity:50];
	[friends appendFormat:@"I love duoduoluo,and you?"];
	NSRange range=[friends rangeOfString:@"you"];
	range.length++;
	[friends deleteCharactersInRange:range];
	NSLog(@"%@",friends);
    [pool drain];
    return 0;
}

输出:[Session started at 2010-08-18 17:25:58 +0800.]
2010-08-18 17:25:58.802 nsstring[148:903] I love duoduoluo,and

The Debugger has exited with status 0

theboy @ 八月 18, 2010 at 17:31 下午

回复

TrackBack URL

Leave a reply