Answers for "delete the last char in a string"

0

java remove last character

String s = "Hello Worlds";
String end = "";
end = s.substring((0, s.length()-1));
Posted by: Guest on June-12-2021
1

java_remove last char

public String method(String str) {
    if (str.charAt(str.length()-1)=='x'){
        str = str.replace(str.substring(str.length()-1), "");
        return str;
    } else{
        return str;
    }
}
Posted by: Guest on May-09-2021

Code answers related to "delete the last char in a string"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language