获取字符串中指定字符位置的内容

//定义字符串
String str="abc:def:ghi";
//取到abc
String str1=str.split(":")[0];
//取到def
String str2=str.split(":")[1];
//取到ghi
String str3=str.split(":")[2];
substring(0, 4)截取到指定位置


猜你喜欢

转载自blog.csdn.net/weixin_39249630/article/details/80702389
今日推荐