📜  javascript 拆分多个值 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:45.693000             🧑  作者: Mango

代码示例1
function splitMulti(str, tokens){
        var tempChar = tokens[0]; // We can use the first token as a temporary join character
        for(var i = 1; i < tokens.length; i++){
            str = str.split(tokens[i]).join(tempChar);
        }
        str = str.split(tempChar);
        return str;
}