Guest User

Untitled

a guest
May 18th, 2018
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -(NSString *) reverseString
  2. {
  3.   NSMutableString *reversedStr;
  4.   int len = [self length];
  5.  
  6.   // Auto released string
  7.   reversedStr = [NSMutableString stringWithCapacity:len];    
  8.  
  9.   // Probably woefully inefficient...
  10.   while (len > 0)
  11.     [reversedStr appendString:
  12.          [NSString stringWithFormat:@"%C", [self characterAtIndex:--len]]];  
  13.  
  14.   return reversedStr;
  15. }
Add Comment
Please, Sign In to add comment