欢迎访问悦橙教程(wld5.com),关注java教程。悦橙教程  java问答|  每日更新
页面导航 : > > > 文章正文

toString.indexOf(":")和subsTring,

来源: javaer 分享于  点击 29940 次 点评:194

toString.indexOf(":")和subsTring,


package com.test2.test;

public class subStirngTest {
    
	public static void main(String[] args) {
    String sb="abcdefgh";
    String sc="abcd:efgh";
    int splitIndex=sc.indexOf(":");//找到标识符的位置
    System.out.println(splitIndex);
	sb.substring(1);
	System.out.println(sb.substring(splitIndex + 1));// splitIndex + 1 的位置开始一直到字符串的结束
} }

运行结果:

4
fgh

相关文章

    暂无相关文章

用户点评