Java usuń ostatni znak z ciągu
String s = "Hello Worlds";
String end = "";
end = s.substring((0, s.length()-1));
Concerned Capybara
String s = "Hello Worlds";
String end = "";
end = s.substring((0, s.length()-1));
private static String removeLastChar(String str) {
return str.substring(0, str.length() - 1);
}
String TEST_STRING = "abcdef";
StringUtils.substring(TEST_STRING, 0, TEST_STRING.length() - 1);