Fast way to split every 'X' letters a text?

I'm wondering if there is a fast way to split a text/string every 'X' letters.

For example:

Split: "Hello, world" every 2 letters

return:

["He","ll","o,"," w","or","ld"]

Something like that?
untitled script pic
With this feature also good will be split by (number) letters .

PS. This script doesn't accept a space

or this
image
image

My go at this

Here.

Thank you to helicoptur and cymplecy.

The reshape idea is what i looking for to use with the map function... Ingenious

That's a cool way to do it, but what if you want to split every 4 letters instead? I think it would be better if the script let you split every any number

Very good method! I was looking for this. I knew there was a way to do it without using a for loop but I didn't know how to do it. Thanks!

Awesome!! A block that returns the splitted string, thanks!

that's a good approach, but it would be great to avoid a for loop, so the script would be more efficient

Always in this script is possible to modification code :slight_smile:
But better solved in (in my opinion) helicoptur's metod.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.