Hàm Bỏ Dấu Tiếng Việt Trong C# – Henrydaiit

Skip to content
  • Home
  • 2020
  • March
  • 9
  • Hàm bỏ dấu tiếng Việt trong C#
Posted inC# March 9, 2020No CommentsHàm bỏ dấu tiếng Việt trong C#

Bỏ dấu bằng cách replace các ký tự có dấu về ký tự không dấu tương ứng

public static string RemoveUnicode(string text)  

{  

string[] arr1 = new string[] { “á”, “à”, “ả”, “ã”, “ạ”, “â”, “ấ”, “ầ”, “ẩ”, “ẫ”, “ậ”, “ă”, “ắ”, “ằ”, “ẳ”, “ẵ”, “ặ”, “đ”, “é”,”è”,”ẻ”,”ẽ”,”ẹ”,”ê”,”ế”,”ề”,”ể”,”ễ”,”ệ”,”í”,”ì”,”ỉ”,”ĩ”,”ị”,”ó”,”ò”,”ỏ”,”õ”,”ọ”,”ô”,”ố”,”ồ”,”ổ”,”ỗ”,”ộ”,”ơ”,”ớ”,”ờ”,”ở”,”ỡ”,”ợ”, “ú”,”ù”,”ủ”,”ũ”,”ụ”,”ư”,”ứ”,”ừ”,”ử”,”ữ”,”ự”, “ý”,”ỳ”,”ỷ”,”ỹ”,”ỵ”,};  

string[] arr2 = new string[] { “a”, “a”, “a”, “a”, “a”, “a”, “a”, “a”, “a”, “a”, “a”, “a”, “a”, “a”, “a”, “a”, “a”,  “d”,  “e”,”e”,”e”,”e”,”e”,”e”,”e”,”e”,”e”,”e”,”e”,”i”,”i”,”i”,”i”,”i”,”o”,”o”,”o”,”o”,”o”,”o”,”o”,”o”,”o”,”o”,”o”,”o”,”o”,”o”,”o”,”o”,”o”,  “u”,”u”,”u”,”u”,”u”,”u”,”u”,”u”,”u”,”u”,”u”, “y”,”y”,”y”,”y”,”y”,};  

for (int i = 0; i < arr1.Length; i++)  

{  

text = text.Replace(arr1[i], arr2[i]);  

text = text.Replace(arr1[i].ToUpper(), arr2[i].ToUpper());  

}  

return text;  

}  

Last updated on March 9, 2020 admin View All Posts

Post navigation

Previous Post
Phần mềm quy phim và chụp màn hình máy tính tốt nhất – Screenpresso Pro 1.7.16.0 Phần mềm quy phim và chụp màn hình máy tính tốt nhất – Screenpresso Pro 1.7.16.0
Next Post
How to debug an outbound IDOC How to debug an outbound IDOC

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply Cancel reply

You must be logged in to post a comment.

Scroll to Top

Từ khóa » Hàm Bỏ Dấu Tiếng Việt Trong C#