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

Re: Adding formatting to a string

by melora (Scribe)
on Jun 17, 2004 at 16:47 UTC ( #367680=note: print w/replies, xml ) Need Help??


in reply to Adding formatting to a string

How about this?
my $string = "ABCDEFGH"; $string = sprintf("%.4s-%s", $string,substr($string,4,4));
Awkward, maybe, but I have tried it and it works.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (1)
As of 2023-06-02 18:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?