Detecting Line Breaks and Replacing it with something else

by Kishore on August 15, 2011

If you want to check for line breaks and want to replace it with a <p></p> or a <br/> tag you can use a simple function in NSString. I came to this situation which working for the iPad version of Kish Multi Pro. I wanted to add the <br /> tag where we have line break so show the post on the UIWebview Controller.

NSString *stringWithBr = [[selectedPost.postContent componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]] componentsJoinedByString:@"<br />"];

  1. Displaying a UIWebView with custom HTML content : In my RSS feed reader project,...
  2. How to get the first image URL from NSString ? : I am working on a RSS...
  3. Kish Multi Pro – What is in Version 4.0 : Just an update on the development...
  4. Do you get paid for tweeting and re-tweeting ? I do make money Tweeting : There are millions who use twitter...
  5. WordPress Blog Manager : You can manage all your blogs...