✅ Reorder letters in a string and group per...
So I've been puzzling with this for a while now, and I am not sure if this actually is what I am looking for but before I dive into what I have, let me explain the premise:
Say I have a text (say a lorem of 200 words) and I strip all punctuations and spaces and newlines and whatever to turn the entire lorem into a single string without any spaces/punctuation-marks/newlines (
Now I group all of these by 6 characters into a single array (done)
Here's the tricky part that I am puzzling with:
I have to turn the whole string into something that looks like this:
So basically, group by 6 characters, and write 5 of those groups in a single "line" (which is obviously 2 lines)
But actually I have to reorder these letters before I do so.
Now the reordering is easy, and the grouping by 6 is easy. It's the actual "how do I write them on two lines with the indexes 0, 1, and 2 on the first line, and 3, 4, 5 on the second line.
Here's what I have to begin with:
but I fear it's not entirely doing what I wanted... please help me out?
Say I have a text (say a lorem of 200 words) and I strip all punctuations and spaces and newlines and whatever to turn the entire lorem into a single string without any spaces/punctuation-marks/newlines (
\r\n)Now I group all of these by 6 characters into a single array (done)
Here's the tricky part that I am puzzling with:
I have to turn the whole string into something that looks like this:
So basically, group by 6 characters, and write 5 of those groups in a single "line" (which is obviously 2 lines)
But actually I have to reorder these letters before I do so.
Now the reordering is easy, and the grouping by 6 is easy. It's the actual "how do I write them on two lines with the indexes 0, 1, and 2 on the first line, and 3, 4, 5 on the second line.
Here's what I have to begin with:
but I fear it's not entirely doing what I wanted... please help me out?