Decimal​Formatter Decimal​Formatter Decimal​Formatter Class

Definition

Formats and parses decimal numbers.

public : sealed class DecimalFormatter : INumberFormatter, INumberFormatter2, INumberFormatterOptions, INumberParser, INumberRounderOption, ISignedZeroOption, ISignificantDigitsOptionpublic sealed class DecimalFormatter : INumberFormatter, INumberFormatter2, INumberFormatterOptions, INumberParser, INumberRounderOption, ISignedZeroOption, ISignificantDigitsOptionPublic NotInheritable Class DecimalFormatter Implements INumberFormatter, INumberFormatter2, INumberFormatterOptions, INumberParser, INumberRounderOption, ISignedZeroOption, ISignificantDigitsOption
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

If your app passes language tags used in this class to any National Language Support functions, it must first convert the tags by calling ResolveLocaleName.

Constructors

DecimalFormatter() DecimalFormatter() DecimalFormatter()

DecimalFormatter(IIterable<String>, String) DecimalFormatter(IIterable<String>, String) DecimalFormatter(IIterable<String>, String)

Creates a DecimalFormatter object initialized by a language list and a geographic region.

public : DecimalFormatter(IIterable<PlatForm::String> languages, PlatForm::String geographicRegion)public DecimalFormatter(IEnumerable<String> languages, String geographicRegion)Public Sub New(languages As IEnumerable<String>, geographicRegion As String)
Parameters
languages
IIterable<PlatForm::String> IEnumerable<String> IEnumerable<String>

The list of language identifiers, in priority order, representing the choice of languages. See Remarks.

geographicRegion
PlatForm::String String String

The identifier for the geographic region.

Attributes

Remarks

If your app passes language tags used in this class to any National Language Support functions, it must first convert the tags by calling ResolveLocaleName.

Starting in : Language tags support the Unicode extensions "ca-" and "nu-". (See Unicode Key/Type Definitions.) Note that the "nu-" extension can affect the numeral system used by DecimalFormatter objects.

See Also

Properties

FractionDigits FractionDigits FractionDigits

Gets or sets the minimum number of digits to display for the fraction part of the number.

public : int FractionDigits { get; set; }public int FractionDigits { get; set; }Public ReadWrite Property FractionDigits As int
Value
int int int

The minimum number of digits to display.

Attributes

GeographicRegion GeographicRegion GeographicRegion

Gets the region that is used when formatting and parsing decimal numbers.

public : PlatForm::String GeographicRegion { get; }public string GeographicRegion { get; }Public ReadOnly Property GeographicRegion As string
Value
PlatForm::String string string

The region that is used.

Attributes

IntegerDigits IntegerDigits IntegerDigits

Gets or sets the minimum number of digits to display for the integer part of the number.

public : int IntegerDigits { get; set; }public int IntegerDigits { get; set; }Public ReadWrite Property IntegerDigits As int
Value
int int int

The minimum number of digits to display.

Attributes

IsDecimalPointAlwaysDisplayed IsDecimalPointAlwaysDisplayed IsDecimalPointAlwaysDisplayed

Gets or sets whether the decimal point of the number should always be displayed.

public : PlatForm::Boolean IsDecimalPointAlwaysDisplayed { get; set; }public bool IsDecimalPointAlwaysDisplayed { get; set; }Public ReadWrite Property IsDecimalPointAlwaysDisplayed As bool
Value
PlatForm::Boolean bool bool

True if the decimal point of the number should always be displayed, and false otherwise.

Attributes

IsGrouped IsGrouped IsGrouped

Gets or sets whether the integer part of the number should be grouped.

public : PlatForm::Boolean IsGrouped { get; set; }public bool IsGrouped { get; set; }Public ReadWrite Property IsGrouped As bool
Value
PlatForm::Boolean bool bool

True if the integer part of the number should be grouped, and false otherwise.

Attributes

IsZeroSigned IsZeroSigned IsZeroSigned

Gets or sets whether -0 is formatted as "-0" or "0".

public : PlatForm::Boolean IsZeroSigned { get; set; }public bool IsZeroSigned { get; set; }Public ReadWrite Property IsZeroSigned As bool
Value
PlatForm::Boolean bool bool

True if -0 is formatted as "-0", and false if -0 is formatted as "0".

Attributes

Remarks

You can set this property to specify that DecimalFormatter display negative 0 as "-0". This enables the scenario where you wish to display "-0" when it represents the rounded value of some small negative value (such as -0.00001).

This property defaults to false to be consistent with Windows 8 and Windows Server 2012, in which -0 was always formatted as "0".

Languages Languages Languages

Gets the priority list of language identifiers that is used when formatting and parsing decimal numbers.

public : IVectorView<string> Languages { get; }public IReadOnlyList<string> Languages { get; }Public ReadOnly Property Languages As IReadOnlyList<string>
Value
IVectorView<PlatForm::String> IReadOnlyList<string> IReadOnlyList<string>

The priority list of language identifiers.

Starting in : Language tags can support Unicode extensions. See the Remarks for the DecimalFormatter(IIterable(String), String) constructor.

Attributes

Remarks

If your app passes language tags from this class to any National Language Support functions, it must first convert the tags by calling ResolveLocaleName.

NumberRounder NumberRounder NumberRounder

Gets or sets the current rounding strategy to be used when formatting numbers.

public : INumberRounder NumberRounder { get; set; }public INumberRounder NumberRounder { get; set; }Public ReadWrite Property NumberRounder As INumberRounder
Attributes

Remarks

When a Format method is called, the appropriate rounding function from the number rounder object manipulates the input prior to it being formatted.

NumeralSystem NumeralSystem NumeralSystem

Gets or sets the numbering system that is used to format and parse decimal numbers.

public : PlatForm::String NumeralSystem { get; set; }public string NumeralSystem { get; set; }Public ReadWrite Property NumeralSystem As string
Value
PlatForm::String string string

A string that indicates the numeral system of the formatter, such as "Latn" for the Latin numeral system (0123456789) or "Arab" for the Arabic-Indic numeral system (٠١٢٣٤٥٦٧٨٩). See the supported NumeralSystem values.

Attributes
See Also

ResolvedGeographicRegion ResolvedGeographicRegion ResolvedGeographicRegion

Gets the geographic region that was most recently used to format or parse decimal values.

public : PlatForm::String ResolvedGeographicRegion { get; }public string ResolvedGeographicRegion { get; }Public ReadOnly Property ResolvedGeographicRegion As string
Value
PlatForm::String string string

The geographic region that was most recently used to format or parse decimal values.

Attributes

ResolvedLanguage ResolvedLanguage ResolvedLanguage

Gets the language that was most recently used to format or parse decimal values.

public : PlatForm::String ResolvedLanguage { get; }public string ResolvedLanguage { get; }Public ReadOnly Property ResolvedLanguage As string
Value
PlatForm::String string string

The language from the priority list of language identifiers that was most recently used to format or parse decimal values.

Starting in : Language tags can support Unicode extensions. See the Remarks for the DecimalFormatter(IIterable(String), String) constructor.

Attributes

Remarks

If your app passes language tags from this class to any National Language Support functions, it must first convert the tags by calling ResolveLocaleName.

SignificantDigits SignificantDigits SignificantDigits

Gets or sets the current padding to significant digits when a decimal number is formatted.

public : int SignificantDigits { get; set; }public int SignificantDigits { get; set; }Public ReadWrite Property SignificantDigits As int
Value
int int int

The number of significant digits.

Attributes

Remarks

Trailing zeros are added to the format until the given number of significant digits is exhausted. If there are more digits, this property does not cause them to be truncated.

Methods

Format(Double) Format(Double) Format(Double)

Returns a string representation of a Double number.

public : PlatForm::String Format(double value)public string Format(Double value)Public Function Format(value As Double) As string
Parameters
value
double Double Double

The Double value to be formatted.

Returns
PlatForm::String string string

A string that represents the number.

Attributes
See Also

Format(Int64) Format(Int64) Format(Int64)

Returns a string representation of an Int64 number.

public : PlatForm::String Format(long value)public string Format(Int64 value)Public Function Format(value As Int64) As string
Parameters
value
long Int64 Int64

The Int64 value to be formatted.

Returns
PlatForm::String string string

A string that represents the number.

Attributes
See Also

Format(UInt64) Format(UInt64) Format(UInt64)

Returns a string representation of a UInt64 number.

public : PlatForm::String Format(unsigned __int64 value)public string Format(UInt64 value)Public Function Format(value As UInt64) As string
Parameters
value
unsigned __int64 UInt64 UInt64

The UInt64 value to be formatted.

Returns
PlatForm::String string string

A string that represents the number.

Attributes
See Also

FormatDouble(Double) FormatDouble(Double) FormatDouble(Double)

Returns a string representation of a Double number.

public : PlatForm::String FormatDouble(double value)public string FormatDouble(Double value)Public Function FormatDouble(value As Double) As string
Parameters
value
double Double Double

The Double value to be formatted.

Returns
PlatForm::String string string

A string that represents the number.

Attributes

FormatInt(Int64) FormatInt(Int64) FormatInt(Int64)

Returns a string representation of an Int64 number.

public : PlatForm::String FormatInt(long value)public string FormatInt(Int64 value)Public Function FormatInt(value As Int64) As string
Parameters
value
long Int64 Int64

The Int64 value to be formatted.

Returns
PlatForm::String string string

A string that represents the number.

Attributes

FormatUInt(UInt64) FormatUInt(UInt64) FormatUInt(UInt64)

Returns a string representation of a UInt64 number.

public : PlatForm::String FormatUInt(unsigned __int64 value)public string FormatUInt(UInt64 value)Public Function FormatUInt(value As UInt64) As string
Parameters
value
unsigned __int64 UInt64 UInt64

The UInt64 value to be formatted.

Returns
PlatForm::String string string

A string that represents the number.

Attributes

ParseDouble(String) ParseDouble(String) ParseDouble(String)

Attempts to parse a string representation of a Double number.

public : IReference<double> ParseDouble(PlatForm::String text)public Nullable<double> ParseDouble(String text)Public Function ParseDouble(text As String) As Nullable( Of double )
Parameters
text
PlatForm::String String String

The text to be parsed.

Returns
IReference<double> Nullable<double> Nullable<double>

If successful, a Double that corresponds to the string representation, and otherwise null.

Attributes

ParseInt(String) ParseInt(String) ParseInt(String)

Attempts to parse a string representation of an integer.

public : IReference<long> ParseInt(PlatForm::String text)public Nullable<long> ParseInt(String text)Public Function ParseInt(text As String) As Nullable( Of long )
Parameters
text
PlatForm::String String String

The text to be parsed.

Returns
IReference<long> Nullable<long> Nullable<long>

If successful, an Int64 that corresponds to the string representation, and otherwise null.

Attributes

ParseUInt(String) ParseUInt(String) ParseUInt(String)

Attempts to parse a string representation of an unsigned integer.

public : IReference<ulong> ParseUInt(PlatForm::String text)public Nullable<ulong> ParseUInt(String text)Public Function ParseUInt(text As String) As Nullable( Of ulong )
Parameters
text
PlatForm::String String String

The text to be parsed.

Returns
IReference<ulong> Nullable<ulong> Nullable<ulong>

If successful, a UInt64 that corresponds to the string representation, and otherwise null.

Attributes

See Also