Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
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 lurking in the Monastery: (5)
As of 2021-10-27 17:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (94 votes). Check out past polls.

    Notices?