Class

NSNumberFormatter

A formatter that converts between numeric values and their textual representations. 数値とそれらのテキスト表現の間で変換するフォーマッタ。

Declaration 宣言

@interface NSNumberFormatter : NSFormatter

Overview 概要

Instances of NSNumberFormatter format the textual representation of cells that contain NSNumber objects and convert textual representations of numeric values into NSNumber objects. The representation encompasses integers, floats, and doubles; floats and doubles can be formatted to a specified decimal position. NSNumberFormatter objects can also impose ranges on the numeric values cells can accept. NSNumberFormatterのインスタンスは、NSNumberオブジェクトを含んでいるセルのテキスト表現の書式を整えます、そして数値のテキスト表現をNSNumberオブジェクトへと変換します。表現は、integer、float、そしてdoubleを網羅します;floatとdoubleは、指定された小数部の桁に書式設定されることができます。NSNumberFormatterオブジェクトはまた、セルが受け入れ可能な数値に範囲を課すことができます。

Significant Digits and Fraction Digits 有効桁と小数桁

The NSNumberFormatter class provides flexible options for displaying non-zero fractional parts of numbers. NSNumberFormatterクラスは、数値の非ゼロ小数部を表示するのに柔軟な選択肢を提供します。

If you set the usesSignificantDigits property to YES, you can configure NSNumberFormatter to display significant digits using the minimumSignificantDigits and maximumSignificantDigits properties. If usesSignificantDigits is NO, these properties are ignored. See Configuring Significant Digits. あなたがusesSignificantDigitsプロパティをYESに設定するならば、あなたはNSNumberFormatterを構成設定して、minimumSignificantDigitsおよびmaximumSignificantDigitsプロパティを使って有効桁数を表示するようにできます。usesSignificantDigitsNOならば、これらのプロパティは無視されます。有効桁数を構成設定するを見てください。

Otherwise, you can configure the minimum and maximum number of integer and fraction digits, or the numbers before and after the decimal separator, respectively, using the minimumIntegerDigits, maximumIntegerDigits, minimumFractionDigits, and maximumFractionDigits properties. See Configuring Integer and Fraction Digits. そうでなければ、あなたは整数と小数桁の最小および最大数を、または小数分離子の前と後の数を、それぞれ、minimumIntegerDigitsmaximumIntegerDigitsminimumFractionDigits、そしてmaximumFractionDigitsプロパティを使って構成設定できます。整数および小数桁を構成設定するを見てください。

Thread Safety スレッド安全

On iOS 7 and later NSNumberFormatter is thread-safe. iOS 7以降ではNSNumberFormatterはスレッド安全です。

In macOS 10.9 and later NSNumberFormatter is thread-safe so long as you are using the modern behavior in a 64-bit app. macOS 10.9以降ではNSNumberFormatterはスレッド安全です、あなたがモダンな挙動を64-bitアプリにおいて使っている限りは。

On earlier versions of the operating system, or when using the legacy formatter behavior or running in 32-bit in macOS, NSNumberFormatter is not thread-safe, and you therefore must not mutate a number formatter simultaneously from multiple threads. オペレーティングシステムの以前のバージョンでは、またはレガシーフォーマッタ挙動を使うまたは32-bitをmacOSで実行する場合、NSNumberFormatterはスレッド安全ではありません、そしてあなたはそのゆえに複数のスレッドから同時に数値フォーマッタを変更してはいけません。

Topics 話題

Configuring Formatter Behavior and Style フォーマッタ挙動と形式を構成設定する

Converting Between Numbers and Strings 数値と文字列の間で変換する

Managing Localization of Numbers 数値のローカライゼーションを管理する

Configuring Rounding Behavior 丸め挙動を構成設定する

Configuring Integer and Fraction Digits 整数および小数桁を構成設定する

Configuring Significant Digits 有効桁数を構成設定する

Configuring Numeric Formats 数値書式設定を構成設定する

Configuring Numeric Symbols 数値表象を構成設定する

Configuring the Format of Currency 通貨の書式設定を構成設定する

Configuring Numeric Prefixes and Suffixes 数値接頭辞と接尾辞を構成設定する

Configuring the Display of Numeric Values 数値の表示を構成設定する

Configuring Separators and Grouping Size 分離子やグループサイズを構成設定する

Managing the Padding of Numbers 数字の詰めを管理する

Managing Input and Output Attributes 入力と出力属性を管理する

Managing Leniency Behavior 寛容挙動を管理する

Managing the Validation of Partial Numeric Strings 不完全な数値的文字列の検証を管理する

Constants 定数

Relationships 関係

Inherits From 継承元

See Also 参照

Numbers さまざまな数