Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: How to zero-pad hex values in sprintf()?

by blue_cowdawg (Monsignor)
on Jan 18, 2013 at 21:11 UTC ( #1014131=note: print w/ replies, xml ) Need Help??


in reply to How to zero-pad hex values in sprintf()?

      am I crazy or do printf() and sprintf() have no way to return, say, 0F instead of just F?

I'm not a psychiatrist and never played one on TV so I can't judge if you're crazy or not. But check out this sniglet of code.

$ perl -e 'printf "%0.4x\n",128;' 0080


Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg


Comment on Re: How to zero-pad hex values in sprintf()?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2014-12-22 06:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (111 votes), past polls