Skip to content

Instantly share code, notes, and snippets.

@etolstoy
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save etolstoy/a4bd6e3d578dff52dde8 to your computer and use it in GitHub Desktop.
Save etolstoy/a4bd6e3d578dff52dde8 to your computer and use it in GitHub Desktop.
IDTMessaging Test
// 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