-(NSString *)getReverseString:(NSString *)tempString
{
NSLog(@"%@",tempString);
NSMutableString *mutableString =[NSMutableString stringWithString:tempString];
for(int i = 0;i<tempString.length;i++)
{
NSString *subStr1 = [tempString substringWithRange:NSMakeRange(i, 1)];
NSString *subStr2 = [tempString substringWithRange:NSMakeRange(tempString.length - i-1, 1)];
NSRange range1 = [tempString rangeOfString:subStr1];
NSRange range2 = [tempString rangeOfString:subStr2];
[mutableString replaceCharactersInRange:range1 withString:subStr2];
[mutableString replaceCharactersInRange:range2 withString:subStr1];
}
tempString = [NSString stringWithFormat:@"%@",mutableString];
return tempString;
}
网友评论