In Cocoa, there is a method (lineBreakBeforeIndex:withinRange:) on NSAttributedString to find appropriate line breaks in a piece of text.
Since NSAttributedString does not exist on the iPhone, does anyone have any suggestions for similar functionality?
Edit: Realized that I'm really looking for a word-wrap algorithm. For example, I want the text to wrap at 80 characters; where do I place line breaks so that words are not split over two lines?
Edit: An example will probably help. Say I have the following lines:
Here is line 1 that probably won't even be 80 characters long.
Here is another line with different text that is longer but not by much.
I would like to turn that into something like:
Here is line 1 that probably
won't even be 80 characters
long.
Here is another line with
different text that is
longer but not by much.
Edit: I'm looking to place this text in a UITextView so that additional edits can be made (very similar to a quoted reply with emails)