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
>