Are .NET string operations case sensitive?

前端 未结 4 2398
时光说笑
时光说笑 2021-02-20 09:33

Are .NET string functions like IndexOf(\"blah\") case sensitive?

From what I remember they aren\'t, but for some reason I am seeing bugs in my app where the

4条回答
  •  自闭症患者
    2021-02-20 09:57

    As default they are case sensitive but most of them (if not all) including IndexOf has an overload that takes a StringComparison argument. E.g. if you pass

    StringComparison.InvariantCultureIgnoreCase 
    

    as the StringComparison argument to IndexOf it will (as the name implies) ignore case differences

提交回复
热议问题