I was working on a project recently where I recieved a data feed and needed to split it into sections that would fit into a text box (ie. 200 characters at a time). The user would then click ‘more‘ and progress through the text in segments until they had read all of it.
I wrote this simple prototype, which splits a string into sections of a defined size (and optionally adds a postfix, ie. “…” to the end), and returns an array containing the segmented text. Read : Splitting Strings »
