Class: NSNumberFormatter

Inherits:
NSFormatter show all

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)

Instance Method Summary (collapse)

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.

Returns:

  • (NSNumberFormatterBehavior)

    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.

Parameters:

  • num (NSNumber)

    The number to localize

  • localizationStyle (NSNumberFormatterStyle)

    The localization style to use. See “NSNumberFormatterStyle” for the supported values.

Returns:

+ (Object) setDefaultFormatterBehavior(behavior)

Sets the default formatter behavior for new instances of NSNumberFormatter .

Parameters:

  • behavior (NSNumberFormatterBehavior)

    An NSNumberFormatterBehavior constant that indicates the revision of the class providing the default behavior.

Returns:

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.

Returns:

  • (Boolean)

    YES if the receiver allows as input floating-point values (that is, values that include the period character [.]), otherwise NO.

- (Boolean) alwaysShowsDecimalSeparator

Returns a Boolean value that indicates whether the receiver always shows a decimal separator, even if the number is an integer.

Returns:

  • (Boolean)

    YES if the receiver always shows a decimal separator, even if the number is an integer, otherwise NO.

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

Returns:

  • (String)

    The receiver’s currency code as a string.

- (String) currencyDecimalSeparator

Returns the receiver’s currency decimal separator as a string.

Returns:

  • (String)

    The receiver’s currency decimal separator as a string.

- (String) currencyGroupingSeparator

Returns the currency grouping separator for the receiver.

Returns:

  • (String)

    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.

Returns:

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

Returns:

  • (String)

    A string containing the character the receiver uses to represent decimal separators.

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

Returns:

  • (String)

    The string the receiver uses as an exponent symbol.

- (NSNumberFormatterBehavior) formatterBehavior

Returns an NSNumberFormatterBehavior constant that indicates the formatter behavior of the receiver.

Returns:

  • (NSNumberFormatterBehavior)

    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.

Returns:

- (Boolean) generatesDecimalNumbers

Returns a Boolean value that indicates whether the receiver creates instances of NSDecimalNumber when it converts strings to number objects.

Returns:

  • (Boolean)

    YES if the receiver creates instances of NSDecimalNumber when it converts strings to number objects, NO if it creates instance of NSNumber.

- (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:.

Parameters:

  • anObject (Object)

    On return, contains an instance of NSDecimalNumber or NSNumber based on the current value of generatesDecimalNumbers. The default is to return NSDecimalNumber instances

  • aString (String)

    A string object with the range of characters specified in rangep that is used to create anObject.

  • rangep (inout NSRange)

    A range of characters in aString. On return, contains the actual range of characters used to create the object.

  • error (Pointer)

    If an error occurs, upon return contains an NSError object that explains the reason why the conversion failed. If you pass in nil for error you are indicating that you are not interested in error information.

Returns:

  • (Boolean)

    YES if the conversion from string to cell-content object was successful, otherwise NO.

- (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”).

Returns:

  • (String)

    A string containing the receiver’s grouping separator.

- (Integer) groupingSize

Returns the receiver’s primary grouping size.

Returns:

  • (Integer)

    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.

Returns:

- (Boolean) isLenient

Returns a Boolean value that indicates whether the receiver uses heuristics to guess at the number which is intended by a string.

Returns:

  • (Boolean)

    YES if the receiver uses heuristics to guess at the number which is intended by the string; otherwise NO.

- (Boolean) isPartialStringValidationEnabled

Returns a Boolean value that indicates whether partial string validation is enabled.

Returns:

  • (Boolean)

    YES if partial string validation is enabled, otherwise NO.

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

Returns:

  • (NSLocale)

    The locale of the receiver.

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

Returns:

  • (NSNumber)

    The highest number allowed as input by the receiver or nil, meaning no limit.

- (Integer) maximumFractionDigits

Returns the maximum number of digits after the decimal separator allowed as input by the receiver.

Returns:

  • (Integer)

    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.

Returns:

  • (Integer)

    The maximum number of integer digits allowed as input by the receiver.

- (Integer) maximumSignificantDigits

Returns the maximum number of significant digits for the receiver.

Returns:

  • (Integer)

    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.

Returns:

  • (NSNumber)

    The lowest number allowed as input by the receiver or nil, meaning no limit.

- (Integer) minimumFractionDigits

Returns the minimum number of digits after the decimal separator allowed as input by the receiver.

Returns:

  • (Integer)

    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.

Returns:

  • (Integer)

    The minimum number of integer digits allowed as input by the receiver.

- (Integer) minimumSignificantDigits

Returns the minimum number of significant digits for the receiver.

Returns:

  • (Integer)

    The minimum number of significant digits for the receiver.

- (String) minusSign

Returns the string the receiver uses to represent the minus sign.

Returns:

  • (String)

    The string that represents the receiver’s 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.

Returns:

- (String) negativeFormat

Returns the format used by the receiver to display negative numbers.

Returns:

- (String) negativeInfinitySymbol

Returns the symbol the receiver uses to represent negative infinity.

Returns:

  • (String)

    The symbol the receiver uses to represent negative infinity.

- (String) negativePrefix

Returns the string the receiver inserts as a prefix to negative values.

Returns:

  • (String)

    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.

Returns:

  • (String)

    The string the receiver adds as a suffix to negative values.

- (String) nilSymbol

Returns the string the receiver uses to represent a nil value.

Returns:

  • (String)

    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.

Returns:

  • (String)

    The symbol the receiver uses to represent NaN (“not a number”) when it converts values.

- (NSNumber) numberFromString(string)

Returns an NSNumber object created by parsing a given string.

Parameters:

  • string (String)

    An NSString object that is parsed to generate the returned number object.

Returns:

  • (NSNumber)

    An NSNumber object created by parsing string using the receiver’s format.

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

Returns:

  • (NSNumberFormatterStyle)

    An NSNumberFormatterStyle constant that indicates the number-formatter style of the receiver.

- (String) paddingCharacter

Returns a string containing the padding character for the receiver.

Returns:

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

Returns:

  • (NSNumberFormatterPadPosition)

- (String) percentSymbol

Returns the string that the receiver uses to represent the percent symbol.

Returns:

- (String) perMillSymbol

Returns the string that the receiver uses for the per-thousands symbol.

Returns:

  • (String)

    The string that the receiver uses for the per-thousands symbol.

- (String) plusSign

Returns the string the receiver uses for the plus sign.

Returns:

  • (String)

    The string the receiver uses for the plus sign.

- (String) positiveFormat

Returns the format used by the receiver to display positive numbers.

Returns:

- (String) positiveInfinitySymbol

Returns the string the receiver uses for the positive infinity symbol.

Returns:

  • (String)

    The string the receiver uses for the positive infinity symbol.

- (String) positivePrefix

Returns the string the receiver uses as the prefix for positive values.

Returns:

  • (String)

    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.

Returns:

  • (String)

    The string the receiver uses as the suffix for positive values.

- (NSNumber) roundingIncrement

Returns the rounding increment used by the receiver.

Returns:

  • (NSNumber)

    The rounding increment used by the receiver.

- (NSNumberFormatterRoundingMode) roundingMode

Returns the rounding mode used by the receiver.

Returns:

  • (NSNumberFormatterRoundingMode)

    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.

Returns:

  • (Integer)

    The size of secondary groupings for the receiver.

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

Parameters:

  • flag (Boolean)

    YES if the receiver allows floating-point values, NO otherwise.

Returns:

- (Object) setAlwaysShowsDecimalSeparator(flag)

Controls whether the receiver always shows the decimal separator, even for integer numbers.

Parameters:

  • flag (Boolean)

    YES if the receiver should always show the decimal separator, NO otherwise.

Returns:

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

Parameters:

  • string (String)

    A string specifying the receiver’s new currency code.

Returns:

- (Object) setCurrencyDecimalSeparator(string)

Sets the string used by the receiver as a decimal separator.

Parameters:

  • string (String)

    The string to use as the currency decimal separator.

Returns:

- (Object) setCurrencyGroupingSeparator(string)

Sets the currency grouping separator for the receiver.

Parameters:

  • string (String)

    The currency grouping separator for the receiver.

Returns:

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

Parameters:

  • string (String)

    A string that represents a local currency symbol.

Returns:

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

Parameters:

  • newSeparator (String)

    The string that specifies the decimal-separator character to use. If newSeparator contains multiple characters, only the first one is used.

Returns:

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

Parameters:

  • string (String)

    A string that represents an exponent symbol.

Returns:

- (Object) setFormatterBehavior(behavior)

Sets the formatter behavior of the receiver.

Parameters:

  • behavior (NSNumberFormatterBehavior)

    An NSNumberFormatterBehavior constant that indicates the revision of the NSNumberFormatter class providing the current behavior.

Returns:

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

Parameters:

  • number (Integer)

    An integer that specifies the format width.

Returns:

- (Object) setGeneratesDecimalNumbers(flag)

Controls whether the receiver creates instances of NSDecimalNumber when it converts strings to number objects. The default is YES.

Parameters:

  • flag (Boolean)

    YES if the receiver should generate NSDecimalNumber instances, NO if it should generate NSNumber instances.

Returns:

- (Object) setGroupingSeparator(string)

Specifies the string used by the receiver for a grouping separator.

Parameters:

  • string (String)

    A string that specifies the grouping separator to use.

Returns:

- (Object) setGroupingSize(numDigits)

Sets the grouping size of the receiver.

Parameters:

  • numDigits (Integer)

    An integer that specifies the grouping size.

Returns:

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

Parameters:

  • string (String)

    A string that represents an international currency symbol.

Returns:

- (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).

Parameters:

  • b (Boolean)

    YES if the receiver will use heuristics to guess at the number which is intended by the string; otherwise NO.

Returns:

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

Parameters:

  • theLocale (NSLocale)

    An NSLocale object representing the new locale of the receiver.

Returns:

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

Parameters:

  • aMaximum (NSNumber)

    A number object that specifies a maximum input value.

Returns:

- (Object) setMaximumFractionDigits(number)

Sets the maximum number of digits after the decimal separator allowed as input by the receiver.

Parameters:

  • number (Integer)

    The maximum number of digits after the decimal separator allowed as input.

Returns:

- (Object) setMaximumIntegerDigits(number)

Sets the maximum number of integer digits allowed as input by the receiver.

Parameters:

  • number (Integer)

    The maximum number of integer digits allowed as input.

Returns:

- (Object) setMaximumSignificantDigits(number)

Sets the maximum number of significant digits for the receiver.

Parameters:

  • number (Integer)

    The maximum number of significant digits for the receiver.

Returns:

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

Parameters:

  • aMinimum (NSNumber)

    A number object that specifies a minimum input value.

Returns:

- (Object) setMinimumFractionDigits(number)

Sets the minimum number of digits after the decimal separator allowed as input by the receiver.

Parameters:

  • number (Integer)

    The minimum number of digits after the decimal separator allowed as input.

Returns:

- (Object) setMinimumIntegerDigits(number)

Sets the minimum number of integer digits allowed as input by the receiver.

Parameters:

  • number (Integer)

    The minimum number of integer digits allowed as input.

Returns:

- (Object) setMinimumSignificantDigits(number)

Sets the minimum number of significant digits for the receiver.

Parameters:

  • number (Integer)

    The minimum number of significant digits for the receiver.

Returns:

- (Object) setMinusSign(string)

Sets the string used by the receiver for the minus sign.

Parameters:

  • string (String)

    A string that represents a minus sign.

Returns:

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

Parameters:

  • number (NSNumber)

    A number object that represents a multiplier.

Returns:

- (Object) setNegativeFormat(aFormat)

Sets the format the receiver uses to display negative values.

Parameters:

  • aFormat (String)

    A string that specifies the format for negative values.

Returns:

- (Object) setNegativeInfinitySymbol(string)

Sets the string used by the receiver for the negative infinity symbol.

Parameters:

  • string (String)

    A string that represents a negative infinity symbol.

Returns:

- (Object) setNegativePrefix(string)

Sets the string the receiver uses as a prefix for negative values.

Parameters:

  • string (String)

    A string to use as the prefix for negative values.

Returns:

- (Object) setNegativeSuffix(string)

Sets the string the receiver uses as a suffix for negative values.

Parameters:

  • string (String)

    A string to use as the suffix for negative values.

Returns:

- (Object) setNilSymbol(string)

Sets the string the receiver uses to represent nil values.

Parameters:

  • string (String)

    A string that represents a nil value.

Returns:

- (Object) setNotANumberSymbol(string)

Sets the string the receiver uses to represent NaN (“not a number”).

Parameters:

  • string (String)

    A string that represents a NaN symbol.

Returns:

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

Parameters:

  • style (NSNumberFormatterStyle)

    An NSNumberFormatterStyle constant that specifies a formatter style.

Returns:

- (Object) setPaddingCharacter(string)

Sets the string that the receiver uses to pad numbers in the formatted string representation.

Parameters:

  • string (String)

    A string containing a padding character (or characters).

Returns:

- (Object) setPaddingPosition(position)

Sets the padding position used by the receiver.

Parameters:

  • position (NSNumberFormatterPadPosition)

    An NSNumberFormatterPadPosition constant that indicates a padding position (before or after prefix or suffix).

Returns:

- (Object) setPartialStringValidationEnabled(enabled)

Sets whether partial string validation is enabled for the receiver.

Parameters:

  • enabled (Boolean)

    YES if partial string validation is enabled, otherwise NO.

Returns:

- (Object) setPercentSymbol(string)

Sets the string used by the receiver to represent the percent symbol.

Parameters:

  • string (String)

    A string that represents a percent symbol.

Returns:

- (Object) setPerMillSymbol(string)

Sets the string used by the receiver to represent the per-mill (per-thousand) symbol.

Parameters:

  • string (String)

    A string that represents a per-mill symbol.

Returns:

- (Object) setPlusSign(string)

Sets the string used by the receiver to represent the plus sign.

Parameters:

  • string (String)

    A string that represents a plus sign.

Returns:

- (Object) setPositiveFormat(aFormat)

Sets the format the receiver uses to display positive values.

Parameters:

  • aFormat (String)

    A string that specifies the format for positive values.

Returns:

- (Object) setPositiveInfinitySymbol(string)

Sets the string used by the receiver for the positive infinity symbol.

Parameters:

  • string (String)

    A string that represents a positive infinity symbol.

Returns:

- (Object) setPositivePrefix(string)

Sets the string the receiver uses as the prefix for positive values.

Parameters:

  • string (String)

    A string to use as the prefix for positive values.

Returns:

- (Object) setPositiveSuffix(string)

Sets the string the receiver uses as the suffix for positive values.

Parameters:

  • string (String)

    A string to use as the suffix for positive values.

Returns:

- (Object) setRoundingIncrement(number)

Sets the rounding increment used by the receiver.

Parameters:

  • number (NSNumber)

    A number object specifying a rounding increment.

Returns:

- (Object) setRoundingMode(mode)

Sets the rounding mode used by the receiver.

Parameters:

  • mode (NSNumberFormatterRoundingMode)

    An NSNumberFormatterRoundingMode constant that indicates a rounding mode.

Returns:

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

Parameters:

  • number (Integer)

    An integer that specifies the size of secondary groupings.

Returns:

- (Object) setTextAttributesForNegativeInfinity(newAttributes)

Sets the text attributes used to display the negative infinity symbol.

Parameters:

  • newAttributes (Hash)

    A dictionary containing text attributes for the display of the negative infinity symbol.

Returns:

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

Parameters:

  • newAttributes (Hash)

    A dictionary containing properties for the display of negative values.

Returns:

- (Object) setTextAttributesForNil(newAttributes)

Sets the text attributes used to display the nil symbol.

Parameters:

  • newAttributes (Hash)

    A dictionary containing text attributes for the display of the nil symbol.

Returns:

- (Object) setTextAttributesForNotANumber(newAttributes)

Sets the text attributes used to display the NaN ("not a number") string.

Parameters:

  • newAttributes (Hash)

    A dictionary containing text attributes for the display of the NaN symbol.

Returns:

- (Object) setTextAttributesForPositiveInfinity(newAttributes)

Sets the text attributes used to display the positive infinity symbol.

Parameters:

  • newAttributes (Hash)

    A dictionary containing text attributes for the display of the positive infinity symbol.

Returns:

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

Parameters:

  • newAttributes (Hash)

    A dictionary containing text attributes for the display of positive values.

Returns:

- (Object) setTextAttributesForZero(newAttributes)

Sets the text attributes used to display a zero value.

Parameters:

  • newAttributes (Hash)

    A dictionary containing text attributes for the display of zero values.

Returns:

- (Object) setUsesGroupingSeparator(flag)

Controls whether the receiver displays the grouping separator.

Parameters:

  • flag (Boolean)

    YES if the receiver should display the grouping separator, NO otherwise.

Returns:

- (Object) setUsesSignificantDigits(b)

Sets whether the receiver uses significant digits.

Parameters:

  • b (Boolean)

    YES if the receiver uses significant digits, otherwise NO.

Returns:

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

Parameters:

  • string (String)

    The string the receiver uses as the symbol to show the value zero.

Returns:

- (String) stringFromNumber(number)

Returns a string containing the formatted value of the provided number object.

Parameters:

  • number (NSNumber)

    An NSNumber object that is parsed to create the returned string object.

Returns:

  • (String)

    A string containing the formatted value of number using the receiver’s current settings.

- (Hash) textAttributesForNegativeInfinity

Returns a dictionary containing the text attributes used to display the negative infinity string.

Returns:

  • (Hash)

    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.

Returns:

  • (Hash)

    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.

Returns:

  • (Hash)

    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.

Returns:

  • (Hash)

    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.

Returns:

  • (Hash)

    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.

Returns:

  • (Hash)

    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.

Returns:

  • (Hash)

    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.

Returns:

  • (Boolean)

    YES if the receiver uses the grouping separator, otherwise NO.

- (Boolean) usesSignificantDigits

Returns a Boolean value that indicates whether the receiver uses significant digits.

Returns:

  • (Boolean)

    YES if the receiver uses significant digits, otherwise NO.

- (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:.

Returns:

  • (String)

    The string the receiver uses as the symbol to show the value zero.