I am working on the cca-175 practice questions. I am given a text file which is split by ‘|’:
Christopher|Jan 11, 2015, |5
Kapil|11 Jan, 2015|5
Then I saved the file as an RDD and tried to map it. However, when used single quote and double quote in the split( ) method, scala returns two different outcomes and using the single quote is right.
Using single quote( split(’|’) ), it returned: Array[String] = Array(Christopher, Jan 11, 2015, 5), which is right.
Using double quote ( split("|")), it returned : Array[String] = Array(C, h, r, i, s, t, o, p, h, e, r, |, J, a, n, " ", 1, 1, , " ", 2, 0, 1, 5, |, 5), which is not what I need.
Can anyone help me with the question?