Following is my REPL output. I am not sure why string.split does not work here.
val s = \"Pedro|groceries|apple|1.42\" s: java.lang.String = Pedro|groceries|
If you use quotes, you're asking for a regular expression split. | is the "or" character, so your regex matches nothing or nothing. So everything is split.
|
If you use split('|') or split("""\|""") you should get what you want.
split('|')
split("""\|""")