Re: examples of sprintf

From: Barry Kimelman (raisin_at_delete-this-trash.mts.net)
Date: 10/02/03


Date: Thu, 2 Oct 2003 08:05:29 -0500


[This followup was posted to comp.lang.perl.misc]

In article <3F7AF041.20009@yahoo.com>, king21122@yahoo.com says...
> Hello
>
> are there some easy examples on how to use the sprintf, examples that
> will assume you don't know any thing about the function and takes you
> one step at the time teaching you the ins and outs on its usage?
> I have read the online docs, but need more easy examples.
>
> I am trying to add numbers 20 infront of the format %d%02d%02d and could
> not find an example on how to do it.
>
> thanks

$string = sprintf "20%d%02d%02d",$number1,$number2,$number3;



Relevant Pages

  • Re: More help optimizing my code
    ... There is absolutely no need to create the cell "tm". ... This was just an example to demonstrate the usage of SPRINTF to create a valid date string: ... Kind regards, Jan ...
    (comp.soft-sys.matlab)
  • Re: I need some help!
    ... But followup can also be a noun, we will see the patient in followup. ... It's a matter of staying current with usage, ... Actually, I can also us workup as an adjective, the ...
    (sci.med.transcription)
  • Re: I need some help!
    ... But followup can also be a noun, we will see the patient in followup. ... It's a matter of staying current with usage, ... Actually, I can also us workup as an adjective, the ...
    (sci.med.transcription)
  • Re: Is there a STL equivalent of sprintf
    ... I have been using sprintf, but I have to declear chararray, and then set ... But if you have to convert a huge number of integers or build huge strings I wouldn't recommend its usage, ... And what's quite "funny", if you want to use stringstream to prevent the usage of sprintf you do it perhaps anyways, because stringstream implementations often use sprintf internally. ...
    (microsoft.public.vc.stl)
  • examples of sprintf
    ... are there some easy examples on how to use the sprintf, ... I have read the online docs, ... I am trying to add numbers 20 infront of the format %d%02d%02d and could ...
    (comp.lang.perl.misc)