Answers for "remove last element string scala"

9

remove last character from string java

private static String removeLastChar(String str) {
    return str.substring(0, str.length() - 1);
}
Posted by: Guest on December-18-2019
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 "remove last element string scala"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language