I need to split a string in javascript (no jquery). This is basically received fron csv. so, i have a string,
string = '"abc, xyz, mno","lmn, pqr, bcd, jkl"';
Note: Number of commas in quoted parts is not fixed for example, "abc, xyz, mno"
can also be "abc, xyz, mno, klm, ..."
or "lmn, pqr, bcd, jkl"
could have been just "lmn"
; i.e no comma at all.
I want to split it as
str1 = 'abc, xyz, mno';
str2 = 'lmn, pqr, bcd, jkl';
I can't do this with string.split(",");
, due to undefined number of commas.
Thanks for any help in advance.
');}t1('"abc,xyz,mno","lmn,pqr,bcd,jkl"');t1('"abc,xyz,mno",lmn');t1('mno,lmn'); – N41 Aug 28 '18 at 20:46