Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8533

Re: UDF for leading zero's in message mapping

$
0
0

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


Viewing all articles
Browse latest Browse all 8533

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>