Show / Hide Table of Contents

Class NumberFormatter

Localises a number.

Inheritance
Object
NumberFormatter
Implements
INumberFormatter
Inherited Members
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Namespace: Sepia.Globalization.Numbers
Assembly: Sepia.Globalization.dll
Syntax
public abstract class NumberFormatter : INumberFormatter

Properties

| Improve this Doc View Source

Locale

The source for localisation information.

Declaration
public Locale Locale { get; set; }
Property Value
Type Description
Locale
| Improve this Doc View Source

NumberingSystem

The localised numbering system to use.

Declaration
public NumberingSystem NumberingSystem { get; set; }
Property Value
Type Description
NumberingSystem
| Improve this Doc View Source

Options

The options to apply when formating a number.

Declaration
public NumberOptions Options { get; set; }
Property Value
Type Description
NumberOptions
| Improve this Doc View Source

Symbols

The localised symbols to use.

Declaration
public NumberSymbols Symbols { get; set; }
Property Value
Type Description
NumberSymbols

Methods

| Improve this Doc View Source

Create(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 locale.

| Improve this Doc View Source

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 value according to the Locale and NumberOptions.

| Improve this Doc View Source

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 value and currencyCode according to the Locale and NumberOptions. The number of significant digits is controlled by currency definition.

| Improve this Doc View Source

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 value according to the Locale and NumberOptions.

| Improve this Doc View Source

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 value and currencyCode according to the Locale and NumberOptions. The number of significant digits is controlled by currency definition.

| Improve this Doc View Source

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 value according to the Locale and NumberOptions.

| Improve this Doc View Source

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 value and currencyCode according to the Locale and NumberOptions. The number of significant digits is controlled by currency definition.

| Improve this Doc View Source

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.

Implements

INumberFormatter
  • Improve this Doc
  • View Source
Back to top Generated by DocFX