Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

(tye)Re: front-pad a number with zero's

by tye (Sage)
on Oct 31, 2001 at 00:18 UTC ( [id://122188]=note: print w/replies, xml ) Need Help??


in reply to front-pad a number with zero's

To both pad short values and (left)truncate long ones: $str= substr("0"x$len.$str,-$len); is another WTDI.

        - tye (but my friends call me "Tye")

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (None)
    As of 2024-04-25 00:57 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found