I want to parse the following lines
3693, Toxic Avenger, (1985), Comedy | Horror
to
3693,
Toxic Avenger, The (1985),
Comedy |. Horror
similarly, the following
161944, The Last Brick in America (2001), Drama
should be analyzed for
161944
The Last Brick in America (2001)
drama
I cannot do this by separating the comma, since there is a comma inside the ",".
Proven solution: LS05 suggested I use a "substring", so I did it and it worked perfectly. here it is.
var pos1 = line.indexOf(',');
var line = line.substring(pos1+1);
pos1 = line.indexOf(',');
pos2 = line.lastIndexOf(',');
let movie_id = line.substring(0,pos1);
let movie_tag = line.substring(pos1+1,pos2);
let movie_timespan = line.substring(pos2+1);
Thanks LS05 :)
source
share