Globalization
Public Class EntryPoint
Shared Sub Main()
Dim ri As RegionInfo = New RegionInfo("x-en-US-metric")
Console.WriteLine(ri.IsMetric)
End Sub
End Class
CHAPTER 9 n WORKING WITH STRINGS 172
Format Strings
You must consider what the format string looks like. The built-in numeric objects use the
standard numeric format strings or the custom numeric format strings defined by the .NET
Framework, which you can find in the Microsoft Developer Network (MSDN) documentation
by searching for ???standard numeric format strings.??? The standard format strings are typically
in the form Axx, where A is the desired format requested and xx is an optional precision specifier.
Examples of format specifiers for numbers are "C" for currency, "D" for decimal, "E" for
scientific notation, "F" for fixed-point notation, and "X" for hexadecimal notation. Every type
also supports "G" for general, which is the default format specifier and is also the format that
you get when you call Object.ToString(), where you cannot specify a format string. If these
format strings don??™t suit your needs, you can even use one of the custom format strings that
allow you to describe what you??™d like in a more-or-less picture format.
The point of this whole mechanism is that each type interprets and defines the format
string specifically in the context of its own needs.
Pages:
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293