I Have String like this
Hello
World
of
Lets See this
>
I want to transform it to:: Hello World of Twitter Lets See this >
How should i perform such activity.on iPhone
I Have String like this
Hello
World
of
Lets See this
>
I want to transform it to:: Hello World of Twitter Lets See this >
How should i perform such activity.on iPhone
Split the string into components and join them by space:
NSString *newString = [[myString componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]] componentsJoinedByString:@" "];
I'm using
[...]
myString = [myString stringByReplacingOccurrencesOfString:@"\n\n" withString:@"\n"];
[...]
/Paul
Splitting the string into components and rejoining them is a very long-winded way to do this. I too use the same method Paul mentioned. You can replace any string occurrences. Further to what Paul said you can completely delete characters like this:
myString = [myString stringByReplacingOccurrencesOfString:@"\n" withString:@""];