isn't there another better stlib fun instead calli...
# announcements
e
isn't there another better stlib fun instead calling
dropWhile
+
drop
?
Copy code
if (file.exists())
        file.readLines()
                .dropWhile { !it.startsWith('#') }.drop(1)
d
you could
readText
, substring on # then split on newline.. not sure if that's any better though 😬
e
file can be also huge, I guess it's not an option for my case
b
filter
maybe?
file.readLines().filter { !it.startsWith("#") }
you’re gonna have just the lines that don’t start with #
e
He need to read from the line starts with ‘#’ and discard all lines before that. Your filter will include those unwanted lines as well
b
yes, sorry I got the questions wrongly
d
@elect you shouldn't use
readLines()
for huge files either
it's basically the same operation
if the file is really that big i think you should just read it normally and make a boolean flag for if you have found your hashtag yet
e
ok, thanks
k
And your current
.dropWhile { ... }.drop(1)
is fine I'd say.
👍 1