Skip to content

Instantly share code, notes, and snippets.

View doraeminemon's full-sized avatar
🎯
Focusing

Do Dinh Thy Son doraeminemon

🎯
Focusing
View GitHub Profile
@doraeminemon
doraeminemon / nonAccentVietnamese.js
Last active October 27, 2022 02:58 — forked from jarvisluong/nonAccentVietnamese.js
Converting standard Vietnamese Characters to non-accent ones. Example: hải -> hai
function nonAccentVietnamese(str) {
str = str.replace(/A|Á|À|Ã||Â|||||Ă||||/g, "A");
str = str.replace(/à|á|||ã|â||||||ă|||||/g, "a");
str = str.replace(/E|É|È|||Ê||||/, "E");
str = str.replace(/è|é||||ê||ế|||/g, "e");
str = str.replace(/I|Í|Ì|Ĩ|/g, "I");
str = str.replace(/ì|í|||ĩ/g, "i");
str = str.replace(/O|Ó|Ò|Õ||Ô|||||Ơ||||/g, "O");
str = str.replace(/ò|ó|||õ|ô||||||ơ|||||/g, "o");
str = str.replace(/U|Ú|Ù|Ũ||Ư||||/g, "U");