Answers for "how to get the last 4 character from a string"

12

java get last char of string

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 February-24-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
0

Complete the function to return the last X number of characters in the given string

def getLast(mystring, x):
    y=len(mystring) - x                  #finding index from where the string needs to be printed
    for i in range(y,(len(mystring))):   # printing from y index to end of string
        print(mystring[i],end="")
    
getLast('WGU College of IT', 13)
Posted by: Guest on February-03-2021

Code answers related to "how to get the last 4 character from a string"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language