// function ltrim(str, chars) {
chars = chars || "\\s";
return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
// right
function rtrim(str, chars) {
chars = chars || "\\s";
return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}
// both
function fTrim(str){
return str.replace(/^\s+|\s+$/g,'');
}
No comments:
Post a Comment