Class: NSNumberFormatter
- Inherits:
-
NSFormatter
- Object
- NSObject
- NSFormatter
- NSNumberFormatter
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.
Class Method Summary (collapse)
-
+ defaultFormatterBehavior
Returns an NSNumberFormatterBehavior constant that indicates default formatter behavior for new instances of NSNumberFormatter.
-
+ localizedStringFromNumber:numberStyle:
Returns a localized number string with the specified style.
-
+ setDefaultFormatterBehavior:
Sets the default formatter behavior for new instances of NSNumberFormatter .
Instance Method Summary (collapse)
-
- allowsFloats
Returns a Boolean value that indicates whether the receiver allows floating-point values as input.
-
- alwaysShowsDecimalSeparator
Returns a Boolean value that indicates whether the receiver always shows a decimal separator, even if the number is an integer.
-
- currencyCode
Returns the receiver’s currency code as a string.
-
- currencyDecimalSeparator
Returns the receiver’s currency decimal separator as a string.
-
- currencyGroupingSeparator
Returns the currency grouping separator for the receiver.
-
- currencySymbol
Returns the receiver’s local currency symbol.
-
- decimalSeparator
Returns a string containing the character the receiver uses to represent decimal separators.
-
- exponentSymbol
Returns the string the receiver uses as an exponent symbol.
-
- formatterBehavior
Returns an NSNumberFormatterBehavior constant that indicates the formatter behavior of the receiver.
-
- formatWidth
Returns the format width of the receiver.
-
- generatesDecimalNumbers
Returns a Boolean value that indicates whether the receiver creates instances of NSDecimalNumber when it converts strings to number objects.
-
- getObjectValue:forString:range:error:
Returns by reference a cell-content object after creating it from a range of characters in a given string.
-
- groupingSeparator
Returns a string containing the receiver’s grouping separator.
-
- groupingSize
Returns the receiver’s primary grouping size.
-
- internationalCurrencySymbol
Returns the international currency symbol used by the receiver.
-
- isLenient
Returns a Boolean value that indicates whether the receiver uses heuristics to guess at the number which is intended by a string.
-
- isPartialStringValidationEnabled
Returns a Boolean value that indicates whether partial string validation is enabled.
-
- locale
Returns the locale of the receiver.
-
- maximum
Returns the highest number allowed as input by the receiver.
-
- maximumFractionDigits
Returns the maximum number of digits after the decimal separator allowed as input by the receiver.
-
- maximumIntegerDigits
Returns the maximum number of integer digits allowed as input by the receiver.
-
- maximumSignificantDigits
Returns the maximum number of significant digits for the receiver.
-
- minimum
Returns the lowest number allowed as input by the receiver.
-
- minimumFractionDigits
Returns the minimum number of digits after the decimal separator allowed as input by the receiver.
-
- minimumIntegerDigits
Returns the minimum number of integer digits allowed as input by the receiver.
-
- minimumSignificantDigits
Returns the minimum number of significant digits for the receiver.
-
- minusSign
Returns the string the receiver uses to represent the minus sign.
-
- multiplier
Returns the multiplier used by the receiver as an NSNumber object.
-
- negativeFormat
Returns the format used by the receiver to display negative numbers.
-
- negativeInfinitySymbol
Returns the symbol the receiver uses to represent negative infinity.
-
- negativePrefix
Returns the string the receiver inserts as a prefix to negative values.
-
- negativeSuffix
Returns the string the receiver adds as a suffix to negative values.
-
- nilSymbol
Returns the string the receiver uses to represent a nil value.
-
- notANumberSymbol
Returns the symbol the receiver uses to represent NaN (“not a number”) when it converts values.
-
- numberFromString:
Returns an NSNumber object created by parsing a given string.
-
- numberStyle
Returns the number-formatter style of the receiver.
-
- paddingCharacter
Returns a string containing the padding character for the receiver.
-
- paddingPosition
Returns the padding position of the receiver.
-
- percentSymbol
Returns the string that the receiver uses to represent the percent symbol.
-
- perMillSymbol
Returns the string that the receiver uses for the per-thousands symbol.
-
- plusSign
Returns the string the receiver uses for the plus sign.
-
- positiveFormat
Returns the format used by the receiver to display positive numbers.
-
- positiveInfinitySymbol
Returns the string the receiver uses for the positive infinity symbol.
-
- positivePrefix
Returns the string the receiver uses as the prefix for positive values.
-
- positiveSuffix
Returns the string the receiver uses as the suffix for positive values.
-
- roundingIncrement
Returns the rounding increment used by the receiver.
-
- roundingMode
Returns the rounding mode used by the receiver.
-
- secondaryGroupingSize
Returns the size of secondary groupings for the receiver.
-
- setAllowsFloats:
Sets whether the receiver allows as input floating-point values (that is, values that include the period character [.]).
-
- setAlwaysShowsDecimalSeparator:
Controls whether the receiver always shows the decimal separator, even for integer numbers.
-
- setCurrencyCode:
Sets the receiver’s currency code.
-
- setCurrencyDecimalSeparator:
Sets the string used by the receiver as a decimal separator.
-
- setCurrencyGroupingSeparator:
Sets the currency grouping separator for the receiver.
-
- setCurrencySymbol:
Sets the string used by the receiver as a local currency symbol.
-
- setDecimalSeparator:
Sets the character the receiver uses as a decimal separator.
-
- setExponentSymbol:
Sets the string used by the receiver to represent the exponent symbol.
-
- setFormatterBehavior:
Sets the formatter behavior of the receiver.
-
- setFormatWidth:
Sets the format width used by the receiver.
-
- setGeneratesDecimalNumbers:
Controls whether the receiver creates instances of NSDecimalNumber when it converts strings to number objects.
-
- setGroupingSeparator:
Specifies the string used by the receiver for a grouping separator.
-
- setGroupingSize:
Sets the grouping size of the receiver.
-
- setInternationalCurrencySymbol:
Sets the string used by the receiver for the international currency symbol.
-
- setLenient:
Sets whether the receiver will use heuristics to guess at the number which is intended by a string.
-
- setLocale:
Sets the locale of the receiver.
-
- setMaximum:
Sets the highest number the receiver allows as input.
-
- setMaximumFractionDigits:
Sets the maximum number of digits after the decimal separator allowed as input by the receiver.
-
- setMaximumIntegerDigits:
Sets the maximum number of integer digits allowed as input by the receiver.
-
- setMaximumSignificantDigits:
Sets the maximum number of significant digits for the receiver.
-
- setMinimum:
Sets the lowest number the receiver allows as input.
-
- setMinimumFractionDigits:
Sets the minimum number of digits after the decimal separator allowed as input by the receiver.
-
- setMinimumIntegerDigits:
Sets the minimum number of integer digits allowed as input by the receiver.
-
- setMinimumSignificantDigits:
Sets the minimum number of significant digits for the receiver.
-
- setMinusSign:
Sets the string used by the receiver for the minus sign.
-
- setMultiplier:
Sets the multiplier of the receiver.
-
- setNegativeFormat:
Sets the format the receiver uses to display negative values.
-
- setNegativeInfinitySymbol:
Sets the string used by the receiver for the negative infinity symbol.
-
- setNegativePrefix:
Sets the string the receiver uses as a prefix for negative values.
-
- setNegativeSuffix:
Sets the string the receiver uses as a suffix for negative values.
-
- setNilSymbol:
Sets the string the receiver uses to represent nil values.
-
- setNotANumberSymbol:
Sets the string the receiver uses to represent NaN (“not a number”).
-
- setNumberStyle:
Sets the number style used by the receiver.
-
- setPaddingCharacter:
Sets the string that the receiver uses to pad numbers in the formatted string representation.
-
- setPaddingPosition:
Sets the padding position used by the receiver.
-
- setPartialStringValidationEnabled:
Sets whether partial string validation is enabled for the receiver.
-
- setPercentSymbol:
Sets the string used by the receiver to represent the percent symbol.
-
- setPerMillSymbol:
Sets the string used by the receiver to represent the per-mill (per-thousand) symbol.
-
- setPlusSign:
Sets the string used by the receiver to represent the plus sign.
-
- setPositiveFormat:
Sets the format the receiver uses to display positive values.
-
- setPositiveInfinitySymbol:
Sets the string used by the receiver for the positive infinity symbol.
-
- setPositivePrefix:
Sets the string the receiver uses as the prefix for positive values.
-
- setPositiveSuffix:
Sets the string the receiver uses as the suffix for positive values.
-
- setRoundingIncrement:
Sets the rounding increment used by the receiver.
-
- setRoundingMode:
Sets the rounding mode used by the receiver.
-
- setSecondaryGroupingSize:
Sets the secondary grouping size of the receiver.
-
- setTextAttributesForNegativeInfinity:
Sets the text attributes used to display the negative infinity symbol.
-
- setTextAttributesForNegativeValues:
Sets the text attributes to be used in displaying negative values .
-
- setTextAttributesForNil:
Sets the text attributes used to display the nil symbol.
-
- setTextAttributesForNotANumber:
Sets the text attributes used to display the NaN ("not a number") string.
-
- setTextAttributesForPositiveInfinity:
Sets the text attributes used to display the positive infinity symbol.
-
- setTextAttributesForPositiveValues:
Sets the text attributes to be used in displaying positive values.
-
- setTextAttributesForZero:
Sets the text attributes used to display a zero value.
-
- setUsesGroupingSeparator:
Controls whether the receiver displays the grouping separator.
-
- setUsesSignificantDigits:
Sets whether the receiver uses significant digits.
-
- setZeroSymbol:
Sets the string the receiver uses as the symbol to show the value zero.
-
- stringFromNumber:
Returns a string containing the formatted value of the provided number object.
-
- textAttributesForNegativeInfinity
Returns a dictionary containing the text attributes used to display the negative infinity string.
-
- textAttributesForNegativeValues
Returns a dictionary containing the text attributes that have been set for negative values.
-
- textAttributesForNil
Returns a dictionary containing the text attributes used to display the nil symbol.
-
- textAttributesForNotANumber
Returns a dictionary containing the text attributes used to display the NaN ("not a number") symbol.
-
- textAttributesForPositiveInfinity
Returns a dictionary containing the text attributes used to display the positive infinity symbol.
-
- textAttributesForPositiveValues
Returns a dictionary containing the text attributes that have been set for positive values.
-
- textAttributesForZero
Returns a dictionary containing the text attributes used to display a value of zero.
-
- usesGroupingSeparator
Returns a Boolean value that indicates whether the receiver uses the grouping separator.
-
- usesSignificantDigits
Returns a Boolean value that indicates whether the receiver uses significant digits.
-
- zeroSymbol
Returns the string the receiver uses as the symbol to show the value zero.
Methods inherited from NSFormatter
#attributedStringForObjectValue:withDefaultAttributes:, #editingStringForObjectValue:, #getObjectValue:forString:errorDescription:, #isPartialStringValid:newEditingString:errorDescription:, #isPartialStringValid:proposedSelectedRange:originalString:originalSelectedRange:errorDescription:, #stringForObjectValue:
Methods inherited from NSObject
#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version
Constructor Details
This class inherits a constructor from NSObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class NSObject
Class Method Details
+ (NSNumberFormatterBehavior) defaultFormatterBehavior
Returns an NSNumberFormatterBehavior constant that indicates default formatter behavior for new instances of NSNumberFormatter.
+ (String) localizedStringFromNumber(num, numberStyle:localizationStyle)
Returns a localized number string with the specified style.
+ (Object) setDefaultFormatterBehavior(behavior)
Sets the default formatter behavior for new instances of NSNumberFormatter .
Instance Method Details
- (Boolean) allowsFloats
Returns a Boolean value that indicates whether the receiver allows floating-point values as input. When this method returns NO, only integer values can be provided as input. The default is YES.
- (Boolean) alwaysShowsDecimalSeparator
Returns a Boolean value that indicates whether the receiver always shows a decimal separator, even if the number is an integer.
- (String) currencyCode
Returns the receiver’s currency code as a string. A currency code is a three-letter code that is, in most cases, composed of a country’s two-character Internet country code plus an extra character to denote the currency unit. For example, the currency code for the Australian dollar is “AUD”. Currency codes are based on the ISO 4217 standard.
- (String) currencyDecimalSeparator
Returns the receiver’s currency decimal separator as a string.
- (String) currencyGroupingSeparator
Returns the currency grouping separator for the receiver.
- (String) currencySymbol
Returns the receiver’s local currency symbol. A country typically has a local currency symbol and an international currency symbol. The local symbol is used within the country, while the international currency symbol is used in international contexts to specify that country’s currency unambiguously. The local currency symbol is often represented by a Unicode code point.
- (String) decimalSeparator
Returns a string containing the character the receiver uses to represent decimal separators. The return value doesn’t indicate whether decimal separators are enabled.
- (String) exponentSymbol
Returns the string the receiver uses as an exponent symbol. The exponent symbol is the “E” or “e” in the scientific notation of numbers, as in 1.0e+56.
- (NSNumberFormatterBehavior) formatterBehavior
Returns an NSNumberFormatterBehavior constant that indicates the formatter behavior of the receiver.
- (Integer) formatWidth
Returns the format width of the receiver. The format width is the number of characters of a formatted number within a string that is either left justified or right justified based on the value returned from paddingPosition.
- (Boolean) generatesDecimalNumbers
Returns a Boolean value that indicates whether the receiver creates instances of NSDecimalNumber when it converts strings to number objects.
- (Boolean) getObjectValue(anObject, forString:aString, range:rangep, error:error)
Returns by reference a cell-content object after creating it from a range of characters in a given string. If there is an error, the delegate (if any) of the control object managing the cell can then respond to the failure in the NSControl delegation method control:didFailToFormatString:errorDescription:.
- (String) groupingSeparator
Returns a string containing the receiver’s grouping separator. For example, the grouping separator used in the United States is the comma (“10,000”) whereas in France it is the space (“10 000”).
- (Integer) groupingSize
Returns the receiver’s primary grouping size.
- (String) internationalCurrencySymbol
Returns the international currency symbol used by the receiver. A country typically has a local currency symbol and an international currency symbol. The local symbol is used within the country, while the international currency symbol is used in international contexts to specify that country’s currency unambiguously. The international currency symbol is often represented by a Unicode code point.
- (Boolean) isLenient
Returns a Boolean value that indicates whether the receiver uses heuristics to guess at the number which is intended by a string.
- (Boolean) isPartialStringValidationEnabled
Returns a Boolean value that indicates whether partial string validation is enabled.
- (NSLocale) locale
Returns the locale of the receiver. A number formatter’s locale specifies default localization attributes, such as ISO country and language codes, currency code, calendar, system of measurement, and decimal separator.
- (NSNumber) maximum
Returns the highest number allowed as input by the receiver. For versions prior to OS X v10.4 (and number-formatter behavior set to NSNumberFormatterBehavior10_0) this method returns an NSDecimalNumber object.
- (Integer) maximumFractionDigits
Returns the maximum number of digits after the decimal separator allowed as input by the receiver.
- (Integer) maximumIntegerDigits
Returns the maximum number of integer digits allowed as input by the receiver.
- (Integer) maximumSignificantDigits
Returns the maximum number of significant digits for the receiver.
- (NSNumber) minimum
Returns the lowest number allowed as input by the receiver. For versions prior to OS X v10.4 (and number-formatter behavior set to NSNumberFormatterBehavior10_0) this method returns an NSDecimalNumber object.
- (Integer) minimumFractionDigits
Returns the minimum number of digits after the decimal separator allowed as input by the receiver.
- (Integer) minimumIntegerDigits
Returns the minimum number of integer digits allowed as input by the receiver.
- (Integer) minimumSignificantDigits
Returns the minimum number of significant digits for the receiver.
- (String) minusSign
Returns the string the receiver uses to represent the minus sign.
- (NSNumber) multiplier
Returns the multiplier used by the receiver as an NSNumber object. A multiplier is a factor used in conversions between numbers and strings (that is, numbers as stored and numbers as displayed). When the input value is a string, the multiplier is used to divide, and when the input value is a number, the multiplier is used to multiply. These operations allow the formatted values to be different from the values that a program manipulates internally.
- (String) negativeFormat
Returns the format used by the receiver to display negative numbers.
- (String) negativeInfinitySymbol
Returns the symbol the receiver uses to represent negative infinity.
- (String) negativePrefix
Returns the string the receiver inserts as a prefix to negative values.
- (String) negativeSuffix
Returns the string the receiver adds as a suffix to negative values.
- (String) nilSymbol
Returns the string the receiver uses to represent a nil value.
- (String) notANumberSymbol
Returns the symbol the receiver uses to represent NaN (“not a number”) when it converts values.
- (NSNumberFormatterStyle) numberStyle
Returns the number-formatter style of the receiver. Styles are essentially predetermined sets of values for certain properties. Examples of number-formatter styles are those used for decimal values, percentage values, and currency.
- (String) paddingCharacter
Returns a string containing the padding character for the receiver.
- (NSNumberFormatterPadPosition) paddingPosition
Returns the padding position of the receiver. The returned constant indicates whether the padding is before or after the number’s prefix or suffix.
- (String) percentSymbol
Returns the string that the receiver uses to represent the percent symbol.
- (String) perMillSymbol
Returns the string that the receiver uses for the per-thousands symbol.
- (String) plusSign
Returns the string the receiver uses for the plus sign.
- (String) positiveFormat
Returns the format used by the receiver to display positive numbers.
- (String) positiveInfinitySymbol
Returns the string the receiver uses for the positive infinity symbol.
- (String) positivePrefix
Returns the string the receiver uses as the prefix for positive values.
- (String) positiveSuffix
Returns the string the receiver uses as the suffix for positive values.
- (NSNumber) roundingIncrement
Returns the rounding increment used by the receiver.
- (NSNumberFormatterRoundingMode) roundingMode
Returns the rounding mode used by the receiver.
- (Integer) secondaryGroupingSize
Returns the size of secondary groupings for the receiver. Some locales allow the specification of another grouping size for larger numbers. For example, some locales may represent a number such as 61, 242, 378.46 (as in the United States) as 6,12,42,378.46. In this case, the secondary grouping size (covering the groups of digits furthest from the decimal point) is 2.
- (Object) setAllowsFloats(flag)
Sets whether the receiver allows as input floating-point values (that is, values that include the period character [.]). By default, floating point values are allowed as input.
- (Object) setAlwaysShowsDecimalSeparator(flag)
Controls whether the receiver always shows the decimal separator, even for integer numbers.
- (Object) setCurrencyCode(string)
Sets the receiver’s currency code. A currency code is a three-letter code that is, in most cases, composed of a country’s two-character Internet country code plus an extra character to denote the currency unit. For example, the currency code for the Australian dollar is “AUD”. Currency codes are based on the ISO 4217 standard.
- (Object) setCurrencyDecimalSeparator(string)
Sets the string used by the receiver as a decimal separator.
- (Object) setCurrencyGroupingSeparator(string)
Sets the currency grouping separator for the receiver.
- (Object) setCurrencySymbol(string)
Sets the string used by the receiver as a local currency symbol. The local symbol is used within the country, while the international currency symbol is used in international contexts to specify that country’s currency unambiguously. The local currency symbol is often represented by a Unicode code point.
- (Object) setDecimalSeparator(newSeparator)
Sets the character the receiver uses as a decimal separator. If you don’t have decimal separators enabled through another means (such as setFormat:), using this method enables them.
- (Object) setExponentSymbol(string)
Sets the string used by the receiver to represent the exponent symbol. The exponent symbol is the “E” or “e” in the scientific notation of numbers, as in 1.0e+56.
- (Object) setFormatterBehavior(behavior)
Sets the formatter behavior of the receiver.
- (Object) setFormatWidth(number)
Sets the format width used by the receiver. The format width is the number of characters of a formatted number within a string that is either left justified or right justified based on the value returned from paddingPosition.
- (Object) setGeneratesDecimalNumbers(flag)
Controls whether the receiver creates instances of NSDecimalNumber when it converts strings to number objects. The default is YES.
- (Object) setGroupingSeparator(string)
Specifies the string used by the receiver for a grouping separator.
- (Object) setGroupingSize(numDigits)
Sets the grouping size of the receiver.
- (Object) setInternationalCurrencySymbol(string)
Sets the string used by the receiver for the international currency symbol. The local symbol is used within the country, while the international currency symbol is used in international contexts to specify that country’s currency unambiguously. The local currency symbol is often represented by a Unicode code point.
- (Object) setLenient(b)
Sets whether the receiver will use heuristics to guess at the number which is intended by a string. If the formatter is set to be lenient, as with any guessing it may get the result number wrong (that is, a number other than that which was intended).
- (Object) setLocale(theLocale)
Sets the locale of the receiver. The locale determines the default values for many formatter attributes, such as ISO country and language codes, currency code, calendar, system of measurement, and decimal separator.
- (Object) setMaximum(aMaximum)
Sets the highest number the receiver allows as input. If aMaximum is nil, checking for the maximum value is disabled. For versions prior to OS X v10.4 (and number-formatter behavior set to NSNumberFormatterBehavior10_0) this method requires an NSDecimalNumber argument.
- (Object) setMaximumFractionDigits(number)
Sets the maximum number of digits after the decimal separator allowed as input by the receiver.
- (Object) setMaximumIntegerDigits(number)
Sets the maximum number of integer digits allowed as input by the receiver.
- (Object) setMaximumSignificantDigits(number)
Sets the maximum number of significant digits for the receiver.
- (Object) setMinimum(aMinimum)
Sets the lowest number the receiver allows as input. If aMinimum is nil, checking for the minimum value is disabled. For versions prior to OS X v10.4 (and number-formatter behavior set to NSNumberFormatterBehavior10_0) this method requires an NSDecimalNumber argument.
- (Object) setMinimumFractionDigits(number)
Sets the minimum number of digits after the decimal separator allowed as input by the receiver.
- (Object) setMinimumIntegerDigits(number)
Sets the minimum number of integer digits allowed as input by the receiver.
- (Object) setMinimumSignificantDigits(number)
Sets the minimum number of significant digits for the receiver.
- (Object) setMinusSign(string)
Sets the string used by the receiver for the minus sign.
- (Object) setMultiplier(number)
Sets the multiplier of the receiver. A multiplier is a factor used in conversions between numbers and strings (that is, numbers as stored and numbers as displayed). When the input value is a string, the multiplier is used to divide, and when the input value is a number, the multiplier is used to multiply. These operations allow the formatted values to be different from the values that a program manipulates internally.
- (Object) setNegativeFormat(aFormat)
Sets the format the receiver uses to display negative values.
- (Object) setNegativeInfinitySymbol(string)
Sets the string used by the receiver for the negative infinity symbol.
- (Object) setNegativePrefix(string)
Sets the string the receiver uses as a prefix for negative values.
- (Object) setNegativeSuffix(string)
Sets the string the receiver uses as a suffix for negative values.
- (Object) setNilSymbol(string)
Sets the string the receiver uses to represent nil values.
- (Object) setNotANumberSymbol(string)
Sets the string the receiver uses to represent NaN (“not a number”).
- (Object) setNumberStyle(style)
Sets the number style used by the receiver. Styles are essentially predetermined sets of values for certain properties. Examples of number-formatter styles are those used for decimal values, percentage values, and currency.
- (Object) setPaddingCharacter(string)
Sets the string that the receiver uses to pad numbers in the formatted string representation.
- (Object) setPaddingPosition(position)
Sets the padding position used by the receiver.
- (Object) setPartialStringValidationEnabled(enabled)
Sets whether partial string validation is enabled for the receiver.
- (Object) setPercentSymbol(string)
Sets the string used by the receiver to represent the percent symbol.
- (Object) setPerMillSymbol(string)
Sets the string used by the receiver to represent the per-mill (per-thousand) symbol.
- (Object) setPlusSign(string)
Sets the string used by the receiver to represent the plus sign.
- (Object) setPositiveFormat(aFormat)
Sets the format the receiver uses to display positive values.
- (Object) setPositiveInfinitySymbol(string)
Sets the string used by the receiver for the positive infinity symbol.
- (Object) setPositivePrefix(string)
Sets the string the receiver uses as the prefix for positive values.
- (Object) setPositiveSuffix(string)
Sets the string the receiver uses as the suffix for positive values.
- (Object) setRoundingIncrement(number)
Sets the rounding increment used by the receiver.
- (Object) setRoundingMode(mode)
Sets the rounding mode used by the receiver.
- (Object) setSecondaryGroupingSize(number)
Sets the secondary grouping size of the receiver. Some locales allow the specification of another grouping size for larger numbers. For example, some locales may represent a number such as 61, 242, 378.46 (as in the United States) as 6,12,42,378.46. In this case, the secondary grouping size (covering the groups of digits furthest from the decimal point) is 2.
- (Object) setTextAttributesForNegativeInfinity(newAttributes)
Sets the text attributes used to display the negative infinity symbol.
- (Object) setTextAttributesForNegativeValues(newAttributes)
Sets the text attributes to be used in displaying negative values . For example, this code excerpt causes negative values to be displayed in red:An even simpler way to cause negative values to be displayed in red is to include the constant [Red] in your format string, as shown in this example: When you set a value’s text attributes to use color, the color appears only when the value’s cell doesn’t have input focus. When the cell has input focus, the value is displayed in standard black.
- (Object) setTextAttributesForNil(newAttributes)
Sets the text attributes used to display the nil symbol.
- (Object) setTextAttributesForNotANumber(newAttributes)
Sets the text attributes used to display the NaN ("not a number") string.
- (Object) setTextAttributesForPositiveInfinity(newAttributes)
Sets the text attributes used to display the positive infinity symbol.
- (Object) setTextAttributesForPositiveValues(newAttributes)
Sets the text attributes to be used in displaying positive values. See setTextAttributesForNegativeValues: for an example of how a related method might be used.
- (Object) setTextAttributesForZero(newAttributes)
Sets the text attributes used to display a zero value.
- (Object) setUsesGroupingSeparator(flag)
Controls whether the receiver displays the grouping separator.
- (Object) setUsesSignificantDigits(b)
Sets whether the receiver uses significant digits.
- (Object) setZeroSymbol(string)
Sets the string the receiver uses as the symbol to show the value zero. By default this is 0; you might want to set it to, for example, “ - ”, similar to the way that a spreadsheet might when a column is defined as accounting.
- (String) stringFromNumber(number)
Returns a string containing the formatted value of the provided number object.
- (Hash) textAttributesForNegativeInfinity
Returns a dictionary containing the text attributes used to display the negative infinity string.
- (Hash) textAttributesForNegativeValues
Returns a dictionary containing the text attributes that have been set for negative values.
- (Hash) textAttributesForNil
Returns a dictionary containing the text attributes used to display the nil symbol.
- (Hash) textAttributesForNotANumber
Returns a dictionary containing the text attributes used to display the NaN ("not a number") symbol.
- (Hash) textAttributesForPositiveInfinity
Returns a dictionary containing the text attributes used to display the positive infinity symbol.
- (Hash) textAttributesForPositiveValues
Returns a dictionary containing the text attributes that have been set for positive values.
- (Hash) textAttributesForZero
Returns a dictionary containing the text attributes used to display a value of zero.
- (Boolean) usesGroupingSeparator
Returns a Boolean value that indicates whether the receiver uses the grouping separator.
- (Boolean) usesSignificantDigits
Returns a Boolean value that indicates whether the receiver uses significant digits.
- (String) zeroSymbol
Returns the string the receiver uses as the symbol to show the value zero. For a discussion of how this is used, see setZeroSymbol:.