Answers for "print the 3rd last character from the 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
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 "print the 3rd last character from the string"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language