I require a function done either in php or delphi(pascal) that takes a huge string and breaks it into specified equal sizes (character) (or almost equal sizes). The breaking should not be done on words e.g
"The bananas are ripe but no one will be allowed to eat them"
If you want to break it as 20 characters, the 20th character would be at "but" so in this case, you break it at the end of "ripe" so that the next starts as a whole word. Therefore we would have
String 1: "The bananas are ripe "
String 2: "but no one will be "
String 3: "allowed to eat them"
or something close to this.
This should be done as a function in either php or delphi pascal OR both.
Delivery timeline is a MUST same day.