Eliminar el último carácter de la cadena
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);
}
#include <string.h>
str[strlen(str)-1] = '\0';
str = str.substring(0, str.length() - 1);
let str = "12345.00";
str = str.substring(0, str.length - 1);
public static String removeLastCharacter(String str) {
String result = null;
if ((str != null) && (str.length() > 0)) {
result = str.substring(0, str.length() - 1);
}
return result;
}