Class NumberFormatter
Localises a number.
Implements
Inherited Members
Namespace: Sepia.Globalization.Numbers
Assembly: Sepia.Globalization.dll
Syntax
public abstract class NumberFormatter : INumberFormatter
Properties
| Improve this Doc View SourceLocale
The source for localisation information.
Declaration
public Locale Locale { get; set; }
Property Value
Type | Description |
---|---|
Locale |
NumberingSystem
The localised numbering system to use.
Declaration
public NumberingSystem NumberingSystem { get; set; }
Property Value
Type | Description |
---|---|
NumberingSystem |
Options
The options to apply when formating a number.
Declaration
public NumberOptions Options { get; set; }
Property Value
Type | Description |
---|---|
NumberOptions |
Symbols
The localised symbols to use.
Declaration
public NumberSymbols Symbols { get; set; }
Property Value
Type | Description |
---|---|
NumberSymbols |
Methods
| Improve this Doc View SourceCreate(Locale, NumberOptions)
Creates or reuses a number formatter for the specified Locale.
Declaration
public static INumberFormatter Create(Locale locale, NumberOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
Locale | locale | The locale. |
NumberOptions | options | The options to apply when formating a number. |
Returns
Type | Description |
---|---|
INumberFormatter | The formatter that is the best for the |
Format(Decimal)
Localises a Decimal.
Declaration
public abstract string Format(decimal value)
Parameters
Type | Name | Description |
---|---|---|
Decimal | value | The number to localise. |
Returns
Type | Description |
---|---|
String | The localised string representation of the |
Format(Decimal, String)
Localises a Decimal currency.
Declaration
public abstract string Format(decimal value, string currencyCode)
Parameters
Type | Name | Description |
---|---|---|
Decimal | value | The number to localise. |
String | currencyCode | An ISO 4217 currency code. For example: "CNY", "NZD" or "JPY". |
Returns
Type | Description |
---|---|
String | The localised string representation of the |
Format(Double)
Localises a Double.
Declaration
public abstract string Format(double value)
Parameters
Type | Name | Description |
---|---|---|
Double | value | The number to localise. |
Returns
Type | Description |
---|---|
String | The localised string representation of the |
Format(Double, String)
Localises a Double currency.
Declaration
public abstract string Format(double value, string currencyCode)
Parameters
Type | Name | Description |
---|---|---|
Double | value | The number to localise. |
String | currencyCode | An ISO 4217 currency code. For example: "CNY", "NZD" or "JPY". |
Returns
Type | Description |
---|---|
String | The localised string representation of the |
Format(Int64)
Localises a Int64.
Declaration
public abstract string Format(long value)
Parameters
Type | Name | Description |
---|---|---|
Int64 | value | The number to localise. |
Returns
Type | Description |
---|---|
String | The localised string representation of the |
Format(Int64, String)
Localises a Int64 currency.
Declaration
public abstract string Format(long value, string currencyCode)
Parameters
Type | Name | Description |
---|---|---|
Int64 | value | The number to localise. |
String | currencyCode | An ISO 4217 currency code. For example: "CNY", "NZD" or "JPY". |
Returns
Type | Description |
---|---|
String | The localised string representation of the |
Resolve()
Resolve any bindings.
Declaration
public virtual void Resolve()
Remarks
This called when all the properties are set for the formatter. Derived classes can then load any extra data that is required.