SHARE
TWEET

Untitled

hhhai0304 Nov 19th, 2019 90 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. String removeVietnamese(String text) {
  2.   final List<String> srcArr = ["á", "à", "ả", "ã", "ạ", "â", "ấ", "ầ", "ẩ", "ẫ", "ậ", "ă", "ắ", "ằ", "ẳ", "ẵ", "ặ",
  3.     "đ",
  4.     "é","è","ẻ","ẽ","ẹ","ê","ế","ề","ể","ễ","ệ",
  5.     "í","ì","ỉ","ĩ","ị",
  6.     "ó","ò","ỏ","õ","ọ","ô","ố","ồ","ổ","ỗ","ộ","ơ","ớ","ờ","ở","ỡ","ợ",
  7.     "ú","ù","ủ","ũ","ụ","ư","ứ","ừ","ử","ữ","ự",
  8.     "ý","ỳ","ỷ","ỹ","ỵ"];
  9.  
  10.   final List<String> targetArr = ["a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a",
  11.     "d",
  12.     "e","e","e","e","e","e","e","e","e","e","e",
  13.     "i","i","i","i","i",
  14.     "o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o","o",
  15.     "u","u","u","u","u","u","u","u","u","u","u",
  16.     "y","y","y","y","y"];
  17.  
  18.   for (int i = 0; i < srcArr.length; i++) {
  19.     text.replaceAll(srcArr[i], targetArr[i]);
  20.     text.replaceAll(srcArr[i].toUpperCase(), targetArr[i].toUpperCase());
  21.   }
  22.   return text;
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top