JAVASCRIPT
자바스크립트에서 replaceAll 함수 사용하기
행복안테나
2011. 7. 22. 13:35
String.prototype.trim = function()
{
return this.replace(/(^\s*)|(\s*$)/gi, "");
}
String.prototype.replaceAll = function( str1, str2 )
{
var temp_str = this.trim();
temp_str = temp_str.replace(eval("/" + str1 + "/gi"), str2);
return temp_str;
}
자바스크립트 안에 넣어주면.. 자바스크립트에서도 replaceAll 함수를 사용할수 있음