startsWith()方法的字符串忽略大小写 [英] startsWith() method of string ignoring case

查看:363
本文介绍了startsWith()方法的字符串忽略大小写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 startsWith() String 的方法但忽略大小写。

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

假设我有字符串会话,我在sEsSi上使用 startsWith 那么它应该返回 true

Suppose I have String "Session" and I use startsWith on "sEsSi" then it should return true.

推荐答案

使用 toUpperCase() toLowerCase()在测试之前标准化你的字符串。

Use toUpperCase() or toLowerCase() to standardise your string before testing it.

这篇关于startsWith()方法的字符串忽略大小写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆