java中substring的用法
生活随笔
收集整理的這篇文章主要介紹了
java中substring的用法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
2019獨角獸企業重金招聘Python工程師標準>>>
java中substring的用法
?
str=str.substring(int beginIndex);截取掉str從首字母起長度為beginIndex的字符串,將剩余字符串賦值給str;即從首字母開始截取beginIndex個字母;
str=str.substring(int beginIndex,int endIndex);截取str中從beginIndex開始至endIndex結束時的字符串,并將其賦值給str;即從第beginIndex位開始截取位字母;
public class Substring {public static void main(String args[]) {String a = "abcd";System.out.println("a=" + a.substring(2));String b = "abcd".substring(0, 2);System.out.println("b=" + b);}}轉載于:https://my.oschina.net/yuhangyes/blog/874183
總結
以上是生活随笔為你收集整理的java中substring的用法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Storm的acker确认机制
- 下一篇: 本机向windows服务器传输文件的三种