cancel
Showing results for 
Search instead for 
Did you mean: 

Number Format

Former Member
0 Kudos

Hi,

I have a number of variable length at the source, now i need to just consider only the last five digits of the number to map it to target, could anybody help me with this. the source field length is always greater than 5.Thank you.

Accepted Solutions (1)

Accepted Solutions (1)

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

Write a simple User Defined Function.

String inputNumber;

Int len= inputNumber.length();
String output= inputNumber.substr(len-6,len-1);
return output

Regards

Bhavesh

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You can use a simple UDF to do this. It will work even if its a number.

The input to the UDFs' will always be string.

input: a,

put this code in your UDF,

return a.substring(a.length()-5,a.length());

This should work.

Regards,

P.Venkat