Split large text string into variable length strings without breaking words and keeping linebreaks a
- by Frank
I am trying to break a large string of text into several smaller strings of text and define each smaller text strings max length to be different. for example:
"The quick brown fox jumped over the red fence.
The blue dog dug under the fence."
I would like to have code that can split this into smaller lines and have the first line have a max of 5 characters, the second line have a max of 11, and rest have a max of 20, resulting in this:
Line 1: The
Line 2: quick brown
Line 3: fox jumped over the
Line 4: red fence.
Line 5: The blue dog
Line 6: dug under the fence.
All this in C# or MSSQL, is it possible?