c# - StringComparison,为什么 "TH"不是以 "T"开头

标签 c# .net vb.net string-comparison

我正在使用StringComparison"vi-VN" 文化;为什么比较字符串 "TH""Th".StartsWith("T", StringComparison.CurrentCulture) 返回 false

最佳答案

Th is a grapheme in Vietnamese .它是一个文本单元,而不是英语中的两个文本单元。因此,Th 不以 T 开头,因为它是自己的独特字符。

您需要使用能够区分 Th 和字母 Th 的文化。例如:

"Th".StartsWith("T", StringComparison.InvariantCulture)

关于c# - StringComparison,为什么 "TH"不是以 "T"开头,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41215297/

相关文章:

c# - 如何在 Xamarin 中检索用户定义的运行时属性?

c# - 如何修复应用服务中的 SNAT 耗尽问题

vb.net - 年、月、日参数描述了无法表示的 DateTime 如何忽略

c# - 如何在 C# 中生成 "system modal dialog"?

sql-server - "System.AccessViolationException: Attempted to read or write protected memory"填充数据表时

c# - Selenium C# 日志记录首选项未完全实现?

c# - 按字母顺序和类型对列表进行排序

c# - 正则表达式.替换标点符号

c# - monodevelop 中如何访问System.Speech 框架?

.net - 在运行时从数据库呈现 ASPX 页面