标签:style blog class code java color
1 @interface NSString (reverse) 2 3 -(NSString *) reverseString; 4 5 @end
1 @implementation NSString (reverse) 2 3 -(NSString *) reverseString { 4 int length = [self length]; 5 NSMutableString *reversedString; 6 7 reversedString = [[NSMutableString alloc] initWithCapacity: length]; 8 9 while(length > 0) { 10 [reversedString appendString:[NSString stringWithFormat:@"%C", [self characterAtIndex:--length]]]; 11 } 12 return [reversedString autorelease]; 13 } 14 @end
Objective C 代码片段(类别),布布扣,bubuko.com
标签:style blog class code java color
原文地址:http://www.cnblogs.com/zendwang/p/3716203.html