How to split text into lines of equal number of characters?
And so, there is text as a line (long line)
you need to divide it into equal + - lines (by the number of characters, including spaces), while you cannot divide words, how can this be implemented?
You split the string by spaces, then you go through the array with reductions, creating an array of strings. You add words to the line of the array until the length is out of bounds, then you push a new line and continue until the full pass.Aurora Snyder
To place the code, please use CodePen or similar tool. Thanks you!