i have a string in javascript like this:
var stringa = 'CONCATENATE("custom text 1", CHAR(10), "text", CHAR(10), "other text", CHAR(10), "another one", CHAR(10), "funny last string")';
My goal is to count the substring inside the string, splitted by ,
, excluding CHAR(10). The constant rule is: substring I need to count are inside " "
so in my example there are 5 substring.
How can I do it only using javascript or jquery?
I've found this solution but I think is there is a more elegant way:
var total = stringa.match(/\"/g) || []).length / 2;