I have a database table that contains a comments column with a 4000 char limit. I want to write an algorithm that can take a variable length comment String (for example 10,000 chars) and break it up into multiple comment records. The database part is easy, its the dynamic parsing of the comment String into multiple Strings. Did I mention I also need to make sure that each comment does not end in the middle of a word, so that means space separated. If anyone has any pseudo code or ideas or knows of any libraries or utils please let me know!
There's a lot of ways this could be done. The pros seem to prefer regex, personally I find regex can be tricky to implement, but that's just me. If you have a lot of parsing to do regex is probably most efficient.