hi please I want
Create a function ‘def filterDataset(lines:Seq[String]):Seq[String]’, using the ‘filter()’ function applying to strings to retrieve only rows that contain the string ‘<dataset:’.
please help me
hi please I want
Create a function ‘def filterDataset(lines:Seq[String]):Seq[String]’, using the ‘filter()’ function applying to strings to retrieve only rows that contain the string ‘<dataset:’.
please help me
Hi,
you may want to have a look at the documentation of filter(..)
It will test every line against the predicate you provide and only keep the lines where predicate(line)
is true.
Hint: the type A
is String
in your case, so you will need a predicate that takes a String
and yields a Boolean
. String.contains(..)
may be helpful.