hi Sanjay,
Add one more parameter to the UDF. name it fieldLength. Pass constant 18 in your case.
then instead of code below:
int len = Integer.parseInt(18);
put
int len = Integer.parseInt(fieldlength);
-----------------------------------------------------------------------------------------------------
If you dont want to add a parameter, use code below
int inputLength = input.length();
try {
Integer.parseInt(input);
// If it is an integer, add 0 (18 - inputLength) times
for (int i=0; i< (18-inputLength);i++)
input = "0" + input;
return input;
} catch (NumberFormatException numForEx) {
// return as it is, if alphanumeric
return input;
}
Ambrish