Compare strings with non-English characters?

后端 未结 7 2119
再見小時候
再見小時候 2021-01-19 07:20

I need to compare strings for a search mechanism on a web site. I use C#. I tried two ways:

consultants.Where(x => 
    x.Description.ToLower().Contains(v         


        
相关标签:
7条回答
  • 2021-01-19 08:18

    Use

    String.Equals(c, vm, StringComparison.OrdinalIgnoreCase)
    

    or

    c.IndexOf(vm, StringComparison.OrdinalIgnoreCase)
    

    Ordinal means Unicode, byte-per-byte, culture-independent comparison.

    0 讨论(0)
提交回复
热议问题