efficiently break Kotlin string into fixed length sub-strings without using regex

Viewed 164

obviously to split can be used to break a string in to sub-strings at specific character or delimiter string, but i was looking for any easy way to break into fixed length sub-strings. eg.

"abcde".splitAt(2) == listOf("ab", "cd", "e")

any ideas?

1 Answers
Related