我有文字规范化方法,我用它来将非英文字母转换成英文字母。
C#方法:
private string normalizeString(string inputWord)
{
StringBuilder stringBuilder = new StringBuilder();
foreach (char c in inputWord.Trim().ToCharArray())
{
string normalizedChar = c.ToString()
.Normalize(NormalizationForm.FormD).Substring(0, 1);
stringBuilder.Append(normalizedChar);
}
return stringBuilder.ToString();
}
示例
Ä => A
ä => a
Ö => O
ö => o
Õ => O
õ => o
Ü => U
ü => u