Re: String Format
From: Jon Skeet [C# MVP] (skeet_at_pobox.com)
Date: 02/27/04
- Next message: Daniel Pratt: "Re: Can a RowState property be changed?"
- Previous message: Philip Rieck: "Re: C# compiler hangs"
- In reply to: Mike Ruane-Torr: "Re: String Format"
- Next in thread: Mike Ruane-Torr: "Re: String Format"
- Reply: Mike Ruane-Torr: "Re: String Format"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 27 Feb 2004 14:13:38 -0000
Mike Ruane-Torr <mike.ruane-torr@USE_EVENS_ixwiflaoyn.net> wrote:
> Thank you for that! I've been going round in circles in the .Net help
> file trying to work out how to do it. Am I right in saying that it
> doesn't exactly mention it anywhere, or have I missed it?
No, it does. Look at "standard numeric format strings":
<quote>
Standard numeric format strings are used to format common numeric
types. A standard format string takes the form Axx where A is a single
alphabetic character called the format specifier, and xx is an optional
integer called the precision specifier. The format specifier must be
one of the built-in format characters. The precision specifier ranges
from 0 to 99 and controls the number of significant digits or zeros to
the right of a decimal. The format string cannot contain white spaces.
</quote>
and then in the "X" specifier:
<quote>
The number is converted to a string of hexadecimal digits. The case of
the format specifier indicates whether to use uppercase or lowercase
characters for the hexadecimal digits greater than 9. For example, use
'X' to produce "ABCDEF", and 'x' to produce "abcdef". The precision
specifier indicates the minimum number of digits desired in the
resulting string. If required, the number is padded with zeros to its
left to produce the number of digits given by the precision specifier.
This format is supported for integral types only.
</quote>
-- Jon Skeet - <skeet@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
- Next message: Daniel Pratt: "Re: Can a RowState property be changed?"
- Previous message: Philip Rieck: "Re: C# compiler hangs"
- In reply to: Mike Ruane-Torr: "Re: String Format"
- Next in thread: Mike Ruane-Torr: "Re: String Format"
- Reply: Mike Ruane-Torr: "Re: String Format"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|