I am currently dealing with the following string:
"ITEM1","ITEM2","ITEM3","ITEM4","ITEM5","ITEM6","ITEM7"~100000000,1000048,0010041,1,1,1,1~100000001,1000050,,2,0,2,1~100000002,1068832,0010124,1,1,1,1~100000003,1143748,0010165,1,1,1,1~100000004,,0010173,1,2,1,1~100000005,,0010199,2,2,2,1~100000006,,0010215,1,2,1,1~100000007,,0010306,0,2,1,1~100000008,1092546,0010355,1,1,1,1~100000009,1037977,,2,1,2,1~
My goal is to split this string by ~
and create separate arrays while adding double quotes ""
. The expected output should be as follows:
[
["ITEM1","ITEM2","ITEM3","ITEM4","ITEM5","ITEM6","ITEM7"],
["100000000","1000048","0010041","1","1","1","1"],
["100000000","1000048","0010041","1","1","1","1"],
["100000000","1000048","0010041","1","1","1","1"],
]
This is what I have attempted so far:
str.split('~').slice(2)
Unfortunately, my current approach does not split the string into separate arrays. Any advice on how to achieve the desired outcome would be greatly appreciated. Thank you in advance.