7 Replies Latest reply: Dec 7, 2017 5:15 AM by Fabio Porta

# How To Remove Leading Zeros in a Number

Hi All,

I have a field with the following values

00000978

00001524

00001024

00012356

The field is in number format.

The length of the field is constant and it is 8.

I would like to remove the leading zeros and would like to have the values as follows:

978

1524

1024

12356

Kindly help me to get the above output.

Regards,

Vinitha.

• ###### Re: How To Remove Leading Zeros in a Number

Hi

Try like this

Num(Num#(FieldName,'#,##0'),'#,##0') AS FieldName;

or

Num(FieldName)

• ###### Re: How To Remove Leading Zeros in a Number

Use the script below

Number8digit
00000978
00001524
00001024
00012356
]
;

• ###### Re: How To Remove Leading Zeros in a Number

NUMBER,

Num(NUMBER) as NUMBER1,

NUM(Right(NUMBER, Len(NUMBER)-FindOneOf(NUMBER, '123456789')+1)) as NUMBER2

Inline

[

NUMBER

00000978

00001524

00001024

00012356

];

• ###### Re: How To Remove Leading Zeros in a Number

Hi,

You can try below code.

replace(ltrim(replace(Number, '0', ' ')), ' ', 0) as New_Number;

Number

00000978

00001524

00001024

00012356

];

Regards

ASHFAQ

• ###### Re: How To Remove Leading Zeros in a Number

Num(YourField)

should be the easiest way.

• ###### Re: How To Remove Leading Zeros in a Number

Hi Vinitha

you can perform below code in your existing work space. try to run below and check.

NUMBER,

Num(NUMBER) as NUMBER1,

NUM(Right(NUMBER, Len(NUMBER)-FindOneOf(NUMBER, '123456789')+1)) as NUMBER2

Inline

[

NUMBER

00000978

00001524

00001024

00012356

];

• ###### Re: How To Remove Leading Zeros in a Number

Mid(FieldValue, FindOneOf(FieldValue,'123546789'))