Last active
August 29, 2015 14:15
-
-
Save etolstoy/a4bd6e3d578dff52dde8 to your computer and use it in GitHub Desktop.
IDTMessaging Test
This file contains 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
// 1. Write a function which takes a string as an argument and returns the string reversed. For example, "abcdef" becomes "fedcba" | |
- (NSString *)revertString:(NSString *)initialString { | |
NSMutableString *revertedString = [[NSMutableString alloc] initWithString:@""]; | |
for (NSInteger i = initialString.length - 1; i >= 0; i--) { | |
char currentChar = [initialString characterAtIndex:i]; | |
[revertedString appendString:[NSString stringWithFormat:@"%c", currentChar]]; | |
} | |
return revertedString; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment