Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Removing leading zeros

by FouRPlaY (Monk)
on May 15, 2001 at 00:34 UTC ( #80335=note: print w/replies, xml ) Need Help??


in reply to Removing leading zeros

I'd do it with a regex like:

s/^0+//g



FouRPlaY
Learning Perl or Going To die() Trying

Replies are listed 'Best First'.
Re^2: Removing leading zeros
by Anonymous Monk on Apr 22, 2019 at 15:07 UTC
    That RE fails multiple edge cases. It will change "0", or "00", etc. into "" making it non-numeric. And not handling the negative case has already been mentioned.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://80335]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2022-12-10 09:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?