JS function to split string and put into array_javascript skills
May 16, 2016 pm 06:05 PMvar InterestKeywordListString = $("#userInterestKeywordLabel").html();
var InterestKeywordListArr = [];
var t = '';
for (var i = 0; i < InterestKeywordListString.length; i ) {
var tmp = InterestKeywordListString.charAt(i);
if (tmp != '' && tmp != ',') {
t = tmp;
lastNum = true;
} else {
if (t != '' && t != ',') {
InterestKeywordListArr.push(t);
t = '';
}
lastNum = false;
}
}
if (t != '' && t != ',') {
InterestKeywordListArr.push(t);
}
for(var i=0;i<InterestKeywordListArr.length;i ){
alert(
InterestKeywordListArr[i]
);
}

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to remove duplicate elements from PHP array using foreach loop?

How to repeat a string in python_python repeating string tutorial

PHP array key value flipping: Comparative performance analysis of different methods

PHP array multi-dimensional sorting practice: from simple to complex scenarios

The Art of PHP Array Deep Copy: Using Different Methods to Achieve a Perfect Copy

Application of PHP array grouping function in data sorting

Best Practices for Deep Copying PHP Arrays: Discover Efficient Methods

The role of PHP array grouping function in finding duplicate elements
