Topic Options
#18314 - 03/28/05 03:40 PM Trim leading zeroes
DustinT12 Offline
Member

Registered: 08/11/03
Posts: 87
Loc: Pittsburgh, PA
Does someone have sample code to trim the leading zeroes from a string? For example, the data string is 0000250, I just want 250 to be returned.

Top
#18315 - 03/28/05 03:58 PM Re: Trim leading zeroes
Anonymous
Unregistered


If you convert the string to an integer you will lose the leading zeros.

Try this.

show(inttostr(strtoint('0000025')))

Top
#18316 - 04/10/07 07:36 PM Re: Trim leading zeroes
Daniel Black Offline
OL Guru

Registered: 04/02/07
Posts: 103
Loc: Salem, Oregon
What I may need (I'm not experienced with the syntax here ) is a statement like this pseudo-code, in conjunction with the string

show(inttostr(strtoint('0000025')))
-----------
substitute any one instance of the number zero that is anchored to beginning of string, with a null
value (s/^0// wink

Top