namespace Remove {
using System;
using System.Text;
using System.Globalization;
class Remove {
[STAThread]
static void Main(string[] args) {
foreach(string st in args) {
Console.WriteLine(RemoveDiacritics(st));
}
}
static string RemoveDiacritics(string stIn) {
string stFormD = stIn.Normalize(NormalizationForm.FormD);
StringBuilder sb = new StringBuilder();
for(int ich = 0; ich < stFormD.Length; ich++) {
UnicodeCategory uc = CharUnicodeInfo.GetUnicodeCategory(stFormD[ich]);
if(uc != UnicodeCategory.NonSpacingMark) {
sb.Append(stFormD[ich]);
}
}
return(sb.ToString().Normalize(NormalizationForm.FormC));
}
}
}
using System;
using System.Text;
using System.Globalization;
class Remove {
[STAThread]
static void Main(string[] args) {
foreach(string st in args) {
Console.WriteLine(RemoveDiacritics(st));
}
}
static string RemoveDiacritics(string stIn) {
string stFormD = stIn.Normalize(NormalizationForm.FormD);
StringBuilder sb = new StringBuilder();
for(int ich = 0; ich < stFormD.Length; ich++) {
UnicodeCategory uc = CharUnicodeInfo.GetUnicodeCategory(stFormD[ich]);
if(uc != UnicodeCategory.NonSpacingMark) {
sb.Append(stFormD[ich]);
}
}
return(sb.ToString().Normalize(NormalizationForm.FormC));
}
}
}
No comments:
Post a Comment