Java Hapus karakter terakhir dari string
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);
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 = "blah blah <br/>";
if (s.endsWith("<br/>")) {
s = s.substring(0, s.length() - 5);
}
String s = "Hello Worlds";
String end = "";
end = s.substring((0, s.length()-1));