Comment supprimer le dernier char dans String Java
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);
}
public static String removeLastCharacter(String str) {
String result = null;
if ((str != null) && (str.length() > 0)) {
result = str.substring(0, str.length() - 1);
}
return result;
}
String s = "Hello Worlds";
String end = "";
end = s.substring((0, s.length()-1));