I am trying to create a program which reads a .txt file and splits the file into separate lists.
I am using this to try and split my strings into 4 parts:
val parts = it.split("\\s".toRegex())
val part1 = parts[0]
val part2 = parts[1]
val part3 = parts[2]
val part4 = parts[3]
(The reason i am using "\s" is that the number of spaces between the words in inconsistent)
However, some lines in the file begin with a space or two which then results in the first word not being detected.
Is there a way for me to ignore or remove only the first white space of each line? As currently when i try to print part[0] it returns as blank