A standard numeric format string takes the form Axx, where A is an alphabetic character called the format specifier, and xx is an optional integer called the precision specifier. The precision specifier ranges from 0 to 99 and affects the number of digits in the result.
Eine Standardformatzeichenfolge für Zahlen besitzt das Format Axx, wobei:A standard numeric format string takes the form Axx, where: A ist ein einzelnes alphabetisches Zeichen, das als Formatbezeichner bezeichnet wird.A is a single alphabetic character called the format specifier.
Standard numeric format strings are supported by: Some overloads of the ToString method of all numeric types. For example, you can supply a numeric format string to the Int32.ToString(String) and Int32.ToString(String, IFormatProvider) methods.
Sie können z.B. eine numerische Formatzeichenfolge an die Int32.ToString(String)-Methode und Int32.ToString(String, IFormatProvider)-Methode übergeben.Beispielsweise das zusammengesetzte Formatierungsfeature von.NET, das von der String.Format-Methode unterstützt wird.Interpolierte Zeichenfolgen.Interpolated strings.
Other results
Example The following example demonstrates two custom numeric format strings.
See the Notes section for additional information about using custom numeric format strings, and the Example section for a comprehensive illustration of their use.
Weitere Informationen über das Verwenden von benutzerdefinierten numerischen Formatzeichenfolgen finden Sie im Abschnitt Hinweise. Der Abschnitt Beispiel enthält eine umfassende Abbildung ihrer Verwendung.
Representing a Byte as a String The Byte type provides full support for standard and custom numeric format strings.
Custom numeric format strings are also supported by the.NET Framework composite formatting feature, which is used by some Write and WriteLine methods of the Console and StreamWriter classes, the String.Format method, and the StringBuilder.AppendFormat method.
Benutzerdefinierte numerische Formatzeichenfolgen werden auch von der.NET Framework-Funktion für die kombinierte Formatierung unterstützt, die von einigen Write-Methoden und WriteLine-Methoden der Console-Klasse und der StreamWriter-Klasse, der String.Format-Methode und der StringBuilder.AppendFormat-Methode verwendet wird.
Using Standard Numeric Format Strings Note The C# examples in this article run in the Try.NET inline code runner and playground.
Hinweis Die C#-Beispiele in diesem Artikel werden in der Inlinecodeausführung und dem Playground von Try.NET ausgeführt.The C# examples in this article run in the Try.NET inline code runner and playground.
Potentially sensitive or inappropriate content
Examples are used only to help you translate the word or expression searched in various contexts. They are not selected or validated by us and can contain inappropriate terms or ideas. Please report examples to be edited or not to be displayed. Potentially sensitive, inappropriate or colloquial translations are usually marked in red or in orange.