Break a string up into substrings all of variable length
suggest changeSame as the known length example, but insert the length into regex:
int length = 5;
String[] parts = str.split("(?<=\\G.{" + length + "})");
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents