手册
目录
收藏800
分享
阅读839
更新时间2025-07-22
前言:
定义和用法endsWith() 方法检查字符串是否以指定字符结尾。提示:请使用 startsWith() 方法检查字符串是否以指定字符开头。实例判断字符串是否以
endsWith() 方法检查字符串是否以指定字符结尾。
提示:请使用 startsWith() 方法检查字符串是否以指定字符开头。
判断字符串是否以指定字符结尾:
String myStr = "Hello";
System.out.println(myStr.endsWith("Hel")); // false
System.out.println(myStr.endsWith("llo")); // true
System.out.println(myStr.endsWith("o")); // true
点击 "运行实例" 按钮查看在线实例
| 参数 | 描述 |
|---|---|
| chars | String,表示要检查的字符。 |
| 返回: |
|
|---|
相关
视频
RELATED VIDEOS
科技资讯
1
2
3
4
5
6
7
8
9
精选课程
共5课时
17.2万人学习
共49课时
77万人学习
共29课时
61.7万人学习
共25课时
39.3万人学习
共43课时
70.9万人学习
共25课时
61.6万人学习
共22课时
23万人学习
共28课时
33.9万人学习
共89课时
125万人学习