Created
February 8, 2012 05:55
-
-
Save aaronpearce/1765891 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString *string = @"Hannah"; | |
NSMutableString *reversedStr; | |
int len = [string length]; | |
reversedStr = [NSMutableString stringWithCapacity:len]; | |
while (len > 0) | |
[reversedStr appendString:[NSString stringWithFormat:@"%C", [string characterAtIndex:--len]]]; | |
if([[string lowercaseString] isEqualToString:[reversedStr lowercaseString]]) { | |
NSLog(@"Plaindrome"); | |
} else { | |
NSLog(@"Not Palindrome"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment