https://kotlinlang.org logo
#announcements
Title
# announcements
p

pierrelucveilleux

03/13/2017, 9:10 PM
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

mfulton26

03/13/2017, 9:17 PM
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

pierrelucveilleux

03/13/2017, 9:31 PM
thanks
2 Views