JSFiddle - React, Tailwind, and code Playground
JavaScript
var strInput = '42, "ich bin, text1", "ich bin, text2", 44, 7, 3, 99, "ich bin, text3"';
var strOutput = [];
{
var intQuotations = 0;
var intFoundPrevious = 0;
for (var intFor1 = 0; intFor1 < strInput.length; intFor1 += 1) {
var strCurrent = strInput.substr(intFor1, 1);
if (strCurrent === '"') {
intQuotations += 1;
} else if (strCurrent === ',') {
if ((intQuotations % 2) === 0) {
var strFoundCurrent = strInput.substr(intFoundPrevious, intFor1 - intFoundPrevious);
intFoundPrevious = intFor1 + 1;
strOutput.push(strFoundCurrent);
}
}
}
}
alert(strOutput.join('\n'));