No. | 方法名称 | 类型 | 描述 |
1 | public String substring(int beginIndex) | 普通 | 从指定索引截取到结尾 |
2 | public String substring(int beginIndex,int endIndex) | 普通 | 截取部分字符串数据。 |
public class Demo {
public static void main(String[] args) {
String str = "helloworld";
String strA = str.substring(5);
String strB = str.substring(0, 5);
System.out.println(strA);
System.out.println(strB);
}
}
