'aaaaaa;bbbbb;;;ccccc;"dddd;eeee";ffff;"gggg;;hhhh";jjjj'
[
"aaaaaa",
"bbbbb",
"",
"",
"ccccc",
"dddd;eeee",
"ffff",
"gggg;;hhhh",
"jjjj",
]
function parse(input) {
const result = []
let i = 0;
while (true) {
let j
if (input[i] === '"') {
j = input.indexOf('"', i + 1) + 1
} else {
j = input.indexOf(';', i)
}
if (j === -1) {
result.push(input.slice(i))
break
}
result.push(input.slice(i, j))
i = j + 1
}
return result.map(s => s[0] === '"' ? s.slice(1, -1) : s)
}
const input = 'aaaaaa;bbbbb;;;ccccc;"dddd;eeee";ffff;"gggg;;hhhh";jjjj'
console.log(parse(input))