Wednesday, August 26, 2009

Replace Char

function ReplaceChar(Str,allowChar,replaceChar)
{

var replacedStr=Str;

for (i=0; i<Str.length; i++)

{

if(allowChar.indexOf(Str.charAt(i)) == -1)

{

replacedStr=replacedStr.replace(Str.charAt(i),replaceChar);

}
}
return replacedStr;

}

No comments:

Post a Comment