I am trying to create a method that takes a list of lists (which reads from a csv file), and a string, and outputs a list of all the data that has that string.
Data example:
"Joe, 14,1989"
"John, 13,1999"
"Mary, 10, 2000"
the function I have is this:
def name(info: List[List[String]], str: String): List[List[String]] =
info.filter(lst =>lst.head.toString == str)
However, I get an empty list in return. What is the best way to compare strings in scala?
info.headsupposed to beList("joe","14","1989")? b/c yes"joe" == "joe"in scala.