java-操作string的常用语法

1、Java判断String是否以某个字符串开头:

String mobile = "8618730600000";
System.out.println(mobile.startsWith("86"));//输出true

2、Java判断String是否以某个字符串结尾:

String mobile = "8618730600000";
System.out.println(mobile.endsWith("0000"));//输出true


posted @ 2019-11-28 00:13  yaohuimo  阅读(198)  评论(0)    收藏  举报