From Jquery how to determine split delimiter?
Let's if I have many split delimiters that I am going to use. How can I write a script in Jquery to determine the which delimiter to use for such case?
eg:开发者_如何学编程 ee 11
ee|11 ee|11 ee-11If we take the above example, It should be spitted by checking the useage of delimiters - from the above list since '|' is twice, split should be done with '|' delimiter.
Any help would be appreciated thanks
You could just split on either...
var chunks = str.split(/[ |-]/);
jsFiddle.
精彩评论