首页 > 其他 > 详细

public int index0f(String str):找查参数字符串在本字符串当中首次出现索引位置,如果没有返回 -1值:

时间:2020-03-14 20:38:07      阅读:99      评论:0      收藏:0      [点我收藏+]
 1 public class String01 {
 2     public static void main(String[] args){
 3      //查找参数字符串在本来字字符串当中出现的第一次索引位置
 4         // 如果根本没有,返回-1
 5         String original = "HelloWorld";
 6         int index =  original.indexOf("llo");
 7         System.out.println("第一次索引值是:"+index);//2
 8         System.out.println("====================");
 9         System.out.println("HelloWord".indexOf("abc"));//压根没有 就返回-1
10     }
11 }

 

public int index0f(String str):找查参数字符串在本字符串当中首次出现索引位置,如果没有返回 -1值:

原文:https://www.cnblogs.com/bingquan1/p/12493933.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!