java通过split截取字符串 java怎么截取字符串中最后一个字符!急?
java怎么截取字符串中最后一个字符!急?使用string类的substring(int from,int to)方法截断字符串位置为from to-1的字符。substring(int index)
java怎么截取字符串中最后一个字符!急?
使用string类的substring(int from,int to)方法截断字符串位置为from to-1的字符。substring(int index)方法截断字符串位置索引-1和所有后续字符串。请注意,字符串的字符位置从0开始,子字符串(int-from,int-to)方法在打开之前是关闭的,即,[from,to],可以理解为[from,to-1]。示例:String name=“helloworld”系统输出打印( 名称.子字符串( 名称.长度()-1, 名称.长度())//输出dSystem.out.println( 名称.子字符串( 名称.长度()-1))//输出D