I want to convert words into tags.
So for example I have an input, if I type in in this
apple, windows, stackoverflow, google, microsoft
then I will get this:开发者_开发百科
apple
windows
stackoverflow
google
microsoft
Delimiters should be space, semicolon, or comma, just like in stackoverflow :)
You can use the split
method to split a string into an array, like this:
var tags = str.split(/\s*[ ,;]\s*/);
精彩评论