Ton*_*ony 0 java string substring
说我有String s = "This is a loooooooooooooooong string";.现在说我要切断This并返回其他所有内容.我该怎么做?我问的是,是否有一种方法可以在x字符后返回所有内容?
就在这里.并且该方法是substring()方法,它以整数作为参数,并在指定的字符位置之前切掉所有内容.
String s = "This is a loooooooooooooooong string";
System.out.println(s.substring(5));
Run Code Online (Sandbox Code Playgroud)
输出:
is a loooooooooooooooong string
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4369 次 |
| 最近记录: |