我有一个小程序,可以替换包含umlauts、撇号等的字符串。
但有时我会折断绳子,比如A代表ü,A代表1/4(或1/4),等等。
有办法解决这些问题吗?
我只是试着用另一个替换语句
str = str.Replace("A¶", "ü");
str = str.Replace("A¼", "ö");
str = str.Replace("ü", "ö");但这对我不起作用
发布于 2013-12-15 06:54:18
看起来是因为它们是非标准字符,所以很难匹配。您可能必须使用Regex.Replace并引用regex:How can you strip non-ASCII characters from a string? (in C#)中字符的Unicode值。
Unicode/UTF8 8参考资料:http://www.utf8-chartable.de/
完整Unicode字符集:http://www.unicode.org/charts/
https://stackoverflow.com/questions/20591972
复制相似问题