Format string

xiaoxiao2021-04-10  475

Format string

[2005-12-11 11:21:32 | Author:

ClyingBoy]

:

|

|

The .NET Framework provides customized, a formatting mechanism suitable for conventional use, which converts values ​​to a string suitable for display. For example, the numerical format can be formatted into hexadecimal, scientific counting, or a series of numbers that are divided by the punctuation symbol specified by the user. Date and time can be formatted into specific countries, regions or regions. The enumeration can be formatted to its value or name.

You can control formatted by specifying format strings and format providers or using default settings. The format string contains one or more format specifiers characters to indicate how to convert values. The format provider provides information on other control, replacement, and regional aspects required for the conversion of specific types.

You can rewrite the method of the format string by implementing the iFormatTable interface; providing your own format provider by implementing the IFORMATPROVIDER interface; perform your own formatting by implementing the ICUSTOMMATTER interface.

.NET Framework provides a composite formatted feature that embeds one or more formatted values ​​into the output string using one or more format strings. Output strings can be used for further processing, displayed to the system console or write to stream.

Format specifier

.NET Framework defines a standard and custom format specifier for formatting numbers, dates, and time and enumeration. A variety of methods of formatting output strings (such as console.writeline, and all types of TOSTRING methods), and some methods of analyzing input strings (such as DateTime.ParseExact) use formatted specifiers.

For information on formatting digital data, see "Digital Format Strings". For a list of common digital format specifiers, see "Standard Digital Format Strings"; see "Custom Digital Format Strings" for custom format spectrices (available to create your own format string).

For information on formatting the date and time, see "Date and Time Format Strings". For a list of common date and time format specifiers, see "Standard DateTime Format string"; see "Custom DateTime Format) for a list of custom time and date format specifiers (available to create your own format string). String ".

For information on formatting enumerations, as well as a list of standard enumeration formats, see "Enumerate String".

Analysis and format specifier

Formatting translates type value into a string representation; analysis is the opposite of formatting, which is created from a string representation. The format provider controls how to perform an analysis, some methods (such as DateTime.Parsexact) use format specifier parameters to indicate the intended format of the string representation. For more information on the analysis, see "Analysis Strings".

Tostring and format specifier

.NET Framework supports the default Tositring method of the overload type. This method performs the basic list of TOSTRING, which uses the format specifier parameter to indicate how to format the value. For more information, see "Formatting Class Types" and IFORMATTABLE interface.

The FORMAT function returns a string setting format in the format String expression.

1.

<% @ Page language = "c #"%>