cancel
Showing results for 
Search instead for 
Did you mean: 

pick last two char from sring

Former Member
0 Kudos

Hi,

I have string which may vary in length; and i have to pick only last two char;

example: ABCDE  then pick DE

              XYZ then pick YZ

              PQ then just pick PQ        

is only UDF can help me? the substring doesnt work for this. I mean This is standard requirement. is there any way we can achive this using standrad functions?   

Thanks. 

Accepted Solutions (1)

Accepted Solutions (1)

rajasekhar_reddy14
Active Contributor
0 Kudos

check below code

String value="somestring"; 
if (value !=null && value.length()>=2){ 
  
String lastTwo=value.substring(value.length()-2);
}

Answers (0)