How to use `string.startsWith()` method ignoring the case?

后端 未结 8 673
暖寄归人
暖寄归人 2020-12-14 05:13

I want to use string.startsWith() method but ignoring the case.

Suppose I have String \"Session\" and I use startsWith on \"sE

8条回答
  •  太阳男子
    2020-12-14 05:44

    use starts with and toLowerCase together

    like this

    "Session".toLowerCase().startsWith("sEsSi".toLowerCase());
    

提交回复
热议问题