Get last 4 characters from string

By | February 19, 2020

You may come across situations where we need to get last 4 characters from a string. Below are the ways to extract last 4 characters of string/integer.

1 First we need to check whether the string length.

2. If the string length is greater then 4 characters then we have to use substring else we can directly print the string.

 

 

Recommended Reads:

Maps in Java with examples

Hashset and LinkedHashset differences in Java

String to String Array conversion in Java

Find common elements in Array List

SQL Date functions

SQL Date functions Part 1

SQL Top Limit usage

Read file in java

 

Leave a Reply

Your email address will not be published. Required fields are marked *