MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Print formated strings

  • To: mathgroup at smc.vnet.net
  • Subject: [mg118370] Re: Print formated strings
  • From: David Annetts <david.annetts at iinet.net.au>
  • Date: Mon, 25 Apr 2011 07:26:44 -0400 (EDT)

Hi Jakub,

The key things you'd want to look at are DigitBlock, NumberPadding & 
NumberSeparator.

eg.

StringDrop[
  ToString@PaddedForm[#, {6, 3}, NumberPadding -> {"0", "0"},
      NumberSeparator -> " ", DigitBlock -> 3] & /@ {60, 123.56789,
    1.45, 5846.75}, {1}]

On 23/04/2011 19:51, ?erých Jakub wrote:
> Dear Mathgroup,
>
> I know, that it must have very easy solution, but I
> cannot find it :-(((
>
> My problem is to print numbers in the string form with predefined
> format. For example I have numbers:
>
> 60
> 123.678123
> 1.45 and
> 5846.123
>
> And I wanted the output:
> 0 060.000
> 0 123.678
> 0 001.450 and
> 5 846.123
>
> Which function is usable for such formating. I came through the ToString,
> Print, Format, StringForm and StringFormat in the help, I was trying to
> use all "See Also" references, but I cannot find it...
>
> Thank for help
>
> Jakub
>


  • Prev by Date: Re: Vertical Headers in TableForm or Grid
  • Next by Date: Re: How to roll up multiple Line calls into a loop
  • Previous by thread: Re: Print formated strings
  • Next by thread: "Curve-threading" surface interpolation?