Let's say we have the following java text block :
String textblock = """
A : 111
B : 111
C : 1111
""";
I would like to split it by lines to get the following result :
String [] splitedTextBlock = splitTextBlockSomeHow(textblock);
// expected result : {"A : 111", "B : 222", "C : 333"}
String.split(text, "\n"). Then again by ":" to get your key/value pairs.text.split("\n")(or eventext.split("\n", -1))text.split(System.lineSeparator())to make it more generictext.lines().toArray()ortext.lines().toList()