Is string.split broken?


#1

So, I’m loading a JSON file which has a big field of pipe separated “subfields” with this code

~file = File("/data/audioDatasets/anto.mp3.stft.json","r");
//a File
~dict = ~file.readAllString.parseYAML
//Dictionary[ (audioFilesPath -> anto.mp3/), (tsv -> 17.01191,-4.1200056,0,0,250.mp3|-3.02001,-17.053967,0,0,43.mp3|0.0019264312,-15.283148,0,0,31.mp3|-4.8303494,-22.181137,0,0,26.mp3|-17.737675,-1.8164012,0,1,67.mp3|17.869148,-3.3443573,0,0,180.mp3|-5.5936565,12.411603,0,2,108.mp3|16.614733,3.0693352,0,0,194.mp3|-4.977811
~dict["tsv"].split("|").size
//1

So, despite having a big string with visible pipes, if I split it using that char as a delimiter, it returns an Array of size 1, what am I missing?? The same thing happens trying with other chars that exists in the string, like “,” or “-”

Trying again with a simple example


~fail = File("/home/tomas/file.txt","r")
//a File
~string = ~fail.readAllString
//delimitando, cosas, con coma, otra, vez
~arr = ~string.split(",")
//[ delimitando, cosas, con coma, otra, vez]
~arr.class
//Array
~arr.size
//1





#2

MY BADD.
Chars are denoted by $, not between “” thats by splitting wasn’t working