Answers for "how to target the last letter of a string in 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
1

last char in string java

public class Test {
    public static void main(String args[]) {
        String string = args[0];
        System.out.println("last character: " +
                           string.substring(string.length() - 1)); 
    }
}
Posted by: Guest on October-15-2020

Code answers related to "how to target the last letter of a string in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language