Answers for "remove last two characters from string java"

28

java remove last character from string

String s = "Hello Worlds";
String end = "";
end = s.substring((0, s.length()-1));
Posted by: Guest on October-19-2020
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
0

kotlin string remove last 3 digits

str.substring(0, str.length() - 2);
Posted by: Guest on April-16-2020
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
0

java substring after last char

String example = "/abc/def/ghfj.doc";
System.out.println(example.substring(example.lastIndexOf("/") + 1));
Posted by: Guest on May-30-2021

Code answers related to "remove last two characters from string java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language