欢迎来到码农权的博客 MaNongGeGe.|

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

复制代码
 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 }
复制代码

 

本文作者:HuangBingQuan

本文链接:https://www.cnblogs.com/bingquan1/p/12493933.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   HuangBingQuan  阅读(330)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起
  1. 1 不将就 码农权
  2. 2 Bleeding Love 码农权
  3. 3 想你念你 码农权
Bleeding Love - 码农权
00:00 / 00:00
An audio error has occurred, player will skip forward in 2 seconds.

Not available