Answers for "perl delete last char from a string"

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 "perl delete last char from a string"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language