Skip to content

Instantly share code, notes, and snippets.

@Thientran2910
Thientran2910 / ConvertVie.js
Created Jul 2, 2019 — forked from hu2di/ConvertVie.js
JavaScript: Chuyển tiếng Việt có dấu sang không dấu
View ConvertVie.js
function change_alias(alias) {
var str = alias;
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");