Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

count in string javascript

console.log(("str1,str2,str3,str4".match(/,/g) || []).length);
//yes, this seems unnecessarly overcomplicated but that's it
//this count the commas
//result 3
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #count #string #javascript
ADD COMMENT
Topic
Name
2+9 =