In python I can do this:
In : "string1|~|string2".split("|~|") Out: ['string1', 'string2']
However, the same code in scala does not give me the expected output:
scala> "string1|~|string2".split("|~|") res3: Array[java.lang.String] = Array("", s, t, r, i, n, g, 1, |, ~, |, s, t, r, i, n, g, 2)
I looked into this question How to split a string by a string in Scala and it seems that my code should work, but it does not. What am I missing? How do I get my desired output?