将用空格,跳格,回车隔开的字符串,转化成以逗号(,)隔开

function Replacing(strInput)
    {
        var strResult = "";
        strResult = strInput.replaceAll("\t",",");
        strResult = strResult.replaceAll("\r",",");
        strResult = strResult.replaceAll("\n",",");
        strResult = strResult.replaceAll(" ",",");
        return strResult;
    }

//很严重的问题,原来少了这么一小段。自定义一个replaceAll函数。

String.prototype.replaceAll = function(s1,s2)

{

    return this.replace(new RegExp(s1,"gm"),s2);

}

posted on 2010-10-22 10:06  冰危节奏  阅读(270)  评论(0)    收藏  举报

导航