0% found this document useful (0 votes)
6 views

complete-reference-vb_net_23

Uploaded by

khalid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

complete-reference-vb_net_23

Uploaded by

khalid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

NumberFormatInfo

Decimal

The Decimal formatter can be used to convert the numerical value to an Integer value. For example:

Console.WriteLine("{0:D}", 125099)

writes 125099 to the console, but

Console.WriteLine("{0:D10}", 125099)

writes 00000125099 to the console, representing ten digits (five as passed by the parameter and five zeros for
left−padding).

Exponential

The Exponential formatter (scientific) formats the value passed to the String in the form of

m.dddE+xxx

As indicated, the decimal point is always preceded by one digit. The number of decimal places is specified by
the precision specifier (six places is the default). You can use the format specifier to determine the case of the
"E" in the output, as illustrated in the following examples:

Console.WriteLine("{0:E}", 125.8)
Console.WriteLine("{0:E10}", 125.88)
Console.WriteLine("{0:E5}", 125.88))

This example writes the following to the console:

1.258000E+002
1.2580000000E+002
1.25880e+002

Fixed−Point

The Fixed−Point formatter is used to convert the value provided in the argument to a String and then specify
the number of places after the decimal point to round the number. For example, the following code:

Console.WriteLine("{0:F}", 125.88)
Console.WriteLine("{0:F10}", 125.88)
Console.WriteLine("{0:F0}", 125.88)

provides this output:

125.88
125.8800000000
126

General

The General formatter is used to convert the String to a numerical value of either fixed− point format or
scientific format. This is often used in calculator software to write to the format that provides a more compact
representation. For example, the following code:

507

You might also like