xxfast
12/01/2022, 10:42 PM\n
to the imported `.txt`sephemient
12/01/2022, 10:49 PM\n
-terminated to begin withephemient
12/01/2022, 10:50 PMA file that contains characters organized into zero or more lines.https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
A sequence of zero or more non- <newline> characters plus a terminating <newline> character.a non-empty file that does not end in a newline is not a text file
Charles Flynn
12/02/2022, 11:12 AMJakub Gw贸藕d藕
12/02/2022, 2:55 PM\n
terminated last lines (and I am a big fan of it, and wouldn鈥檛 have it any other way) is that String.lines()
always end up with an empty string at the end, so it鈥檚 best to add .filter(String::isNotBlank)
.CLOVIS
12/04/2022, 7:51 PMlines()
? We clearly don't expect a terminal LF
character to represent an empty line.Jakub Gw贸藕d藕
12/04/2022, 7:55 PMCLOVIS
12/04/2022, 8:04 PMephemient
12/05/2022, 12:16 AMephemient
12/05/2022, 12:17 AMsplit()
or lines()
then you have nothing to worry aboutephemient
12/05/2022, 12:19 AM"a\nb\nc\n".lines() == listOf("a", "b", "c", "")
"a\nb\nc\n".reader().readLines() == listOf("a", "b", "c")
although it is more natural to use readLines()
on a File
than on a String