<div>function removeUnicode(str) {</div>
<div> if (typeof str != 'string') {</div>
<div> return str;</div>
<div> }</div>
<div> str = str.toLowerCase();</div>
<div> str = str.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g, "a");</div>
<div> str = str.replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g, "e");</div>
<div> str = str.replace(/ì|í|ị|ỉ|ĩ/g, "i");</div>
<div> str = str.replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/g, "o");</div>
<div> str = str.replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ/g, "u");</div>
<div> str = str.replace(/ỳ|ý|ỵ|ỷ|ỹ/g, "y");</div>
<div> str = str.replace(/đ/g, "d");</div>
<div> str = str.replace(/!|@|%|\^|\*|\(|\)|\+|\=|\<|\>|\?|\/|,|\.|\:|\;|\'|\"|\&|\#|\[|\]|~|$|_/g, "");</div>
<div> str = str.replace(/-+-/g, " ");</div>
<div> str = str.replace(/^\-+|\-+$/g, " ");</div>
<div> return str;</div>
<div>}</div>
function removeUnicode(str) {
if (typeof str != 'string') {
return str;
}
str = str.toLowerCase();
str = str.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g, "a");
str = str.replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g, "e");
str = str.replace(/ì|í|ị|ỉ|ĩ/g, "i");
str = str.replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/g, "o");
str = str.replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ/g, "u");
str = str.replace(/ỳ|ý|ỵ|ỷ|ỹ/g, "y");
str = str.replace(/đ/g, "d");
str = str.replace(/!|@|%|\^|\*|\(|\)|\+|\=|\<|\>|\?|\/|,|\.|\:|\;|\'|\"|\&|\#|\[|\]|~|$|_/g, "");
str = str.replace(/-+-/g, " ");
str = str.replace(/^\-+|\-+$/g, " ");
return str;
}
|