Is kotlin readText() should take care of newline o...
# announcements
p
Is kotlin readText() should take care of newline on different os? https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.io/java.io.-file/read-text.html
m
readText will do just that, read the text, so if it reads different line endings than the host OS it won't bother differentiating however, kotlin lineSequence is a different story: it will split lines even with mixed line endings (CR, LF, or CR): https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/line-sequence.html
you might also take a look at useLines, forEachLine, and readLines for files
p
thanks