Answers for "javascript loop through delimited string"

0

javascript loop through delimited string

var str = 'Hello, World, etc';
var str_array = str.split(',');

for(var i = 0; i < str_array.length; i++) {
   // Trim the excess whitespace.
   str_array[i] = str_array[i].replace(/^\s*/, "").replace(/\s*$/, "");
   // Add additional code here, such as:
   alert(str_array[i]);
}
Posted by: Guest on April-29-2022

Code answers related to "javascript loop through delimited string"

Code answers related to "Javascript"

Browse Popular Code Answers by Language