Last active
October 26, 2018 05:11
-
-
Save minhlucvan/8e981428f11803c812435e4a731463d6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function changeAlias( alias ) { | |
if( !alias instanceof String ) return ""; | |
return alias | |
.replace(/À|Á|Ạ|Ả|Ã|Â|Ầ|Ấ|Ậ|Ẩ|Ẫ|Ă|Ằ|Ắ|Ặ|Ẳ|Ẵ/g, "A") | |
.replace(/È|É|Ẹ|Ẻ|Ẽ|Ê|Ề|Ế|Ệ|Ể|Ễ/g, "E") | |
.replace(/Ì|Í|Ị|Ỉ|Ĩ/g, "I") | |
.replace(/Ò|Ó|Ọ|Ỏ|Õ|Ô|Ồ|Ố|Ộ|Ổ|Ỗ|Ơ|Ờ|Ớ|Ợ|Ở|Ỡ/g, "O") | |
.replace(/Ù|Ú|Ụ|Ủ|Ũ|Ư|Ừ|Ứ|Ự|Ử|Ữ/g, "U") | |
.replace(/Ỳ|Ý|Ỵ|Ỷ|Ỹ/g, "Y") | |
.replace(/Đ/g, "D") | |
.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g, "a") | |
.replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g, "e") | |
.replace(/ì|í|ị|ỉ|ĩ/g, "i") | |
.replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/g, "o") | |
.replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ/g, "u") | |
.replace(/ỳ|ý|ỵ|ỷ|ỹ/g, "y") | |
.replace(/đ/g, "d"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment