Possible Duplicate:
Replace tab in NSString with \t
As per the title: is there a way to convert tabs (\t
) into white space when loading a text file into an NSString? I am trying to convert a text file and they're giving me trouble.
Possible Duplicate:
Replace tab in NSString with \t
As per the title: is there a way to convert tabs (\t
) into white space when loading a text file into an NSString? I am trying to convert a text file and they're giving me trouble.
This should work:
NSString *test = @"hi\tsecond column\t";
NSString *stringWithWhiteSpace = [test stringByReplacingOccurencesOfString:@"\t" withString: @" ";
test
is just a test string that would be the text file you're loading. stringWithWhiteSpace
is the string with white space instead of tabs.