Split a long string every n characters using Relevance

Hi!
I have a file which may contain a very long string (eg: A base64 encoding)
I would want to split it every n characters in order for an inspector to return a plural object of type substring.
The problem is that the string will not contain a “splittable” character.

Any idea on how to accomplish this?

EG: String=
12341234123412341234123412
split every 4 char:
1234
1234
1234

12

Here’s an example that splits a string every 4 characters:

(if length of it >= 4 then firsts 4 of it else it) of (it & following text of it) of characters whose (start of it mod 4 = 0) of ("abcdefghijklmnopqrstuvwxyz")

6 Likes

Thanks Aram!
Works wonders!
Never tought of using the modulo operator in this way :slight_smile: