string字符串去掉最后一位字母java
可以使用String.substring()方法来去掉字符串的最后一位字母。例如:
String str = "example"; String newStr = str.substring(0, str.length()-1); System.out.println(newStr);
这将输出 "exampl",去掉了原始字符串的最后一个字母 "e"。
原文地址: https://www.cveoy.top/t/topic/ggLC 著作权归作者所有。请勿转载和采集!