cancel
Showing results for 
Search instead for 
Did you mean: 

How to Remove leading zeroes

Former Member
0 Kudos

Hi,

Need to map IDOC field DOCNUM to DocID and i need to remove the leading zeroes for the result.

Pls suggest me which function i need to use

Thanks & Regards,

Y.Raj

Accepted Solutions (1)

Accepted Solutions (1)

santhosh_kumarv
Active Contributor
0 Kudos

Use the Arithmetic function multiply or divide by 1.

DOCNUM & Constant(1) -


> Divide or Multiply -


> target

Thanks

SaNv...

Answers (5)

Answers (5)

Former Member
0 Kudos

Thanks for your valuable replies....

Regards,

Y.Raj

Former Member
0 Kudos

You can also use the Arithmetic funtion FormatNumber and change the number format to #0

This will remove all the leading zero and works perfectly (we use it a lot)

Former Member
0 Kudos

Hi,

Use this UDF code

Here input field name is IDTNR

int n = idtnr.length();

String str = idtnr;

for(int i=0; i< n; i++)

{

If(!idtnr<i>.equals('0'))

{

str = idtnr.subString(i,n);

break;

}

}

return str;

(or)

String y=idtnr;

while(idtnr.startsWith("0"))

{

y=idtnr.replaceFirst("0","");

}

return y;

Former Member
0 Kudos

Hi,

create UDF with one input and use this code..

String docNum = //ur UDF input...

int index=0;

for(int i=0;i<docNum.length();i++) {
  char temp ='0';
  char c = docNum.charAt(i);
  if(temp==c) {
    index=index+1; 
   }
   else break;

Thanks

Farooq

Former Member
0 Kudos

you can use rtrim

agasthuri_doss
Active Contributor
0 Kudos

Hi,

You can also try with UDF

//write your code here

String output = input.replaceFirst("^0+","");

return output;

Cheers

Agasthuri Doss