Java 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);
}
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;
}
public static String removeLastChar(String s){
String end = "";
if(s.length()-1>0){
end = s.substring(0, s.length()-1);
System.out.println(s+"_"+end);}
return end; }
//corrected code