Up
Authors
Fred Kiefer (FredKiefer@gmx.de
)
Richard Frith-Macdonald (rfm@gnu.org
)
Date: Generated at 2024-11-18 21:56:13 +0100
Copyright: (C) 2000 Free Software Foundation, Inc.
class_NSNumberFormatter
NSFormatter
NSFormatter
NSNumberFormatter
NSNumberFormatter
NSFormatter->NSNumberFormatter
Declared in:
Foundation/NSNumberFormatter.h
Availability: MacOS-X 10.0.0
This class is currently not fully implemented! All
set methods will work, but stringForObject: will
ignore the format completely. The documentation
below describes what the behavior SHOULD be...
A specialization of the
NSFormatter
class for generating string representations of
numbers ([NSNumber] and
NSDecimalNumber
instances) and for parsing numeric values in strings.
See the
NSFormatter
documentation for description of the
basic methods for formatting and parsing that
are available.
There are no convenience initializers or
constructors for this class. Instead, to
obtain an instance, call alloc init and then
-setFormat:
.
The basic format of a format string uses "#"
signs to represent digits, and other characters
to represent themselves, in a context-dependent
way. Thus, for example, @"#,###.00"
means to print the number ending in.00 if it
has no decimal part, otherwise print two decimal
places, and to print one comma if it is
greater than 1000. Thus, 1000 prints as
"1,000.00", and 1444555.979 prints as
"1444,555.98" (see
-setRoundingBehavior:).
After setting the format, you may change the
thousands separator and decimal point using
set methods, or by calling
-setLocalizesFormat:
.
You may set separate formats to be used for
positive numbers, negative numbers, and zero
independently.
In addition, this class supports attributed
strings (see
NSAttributedString
), so that you can specify font and color attributes, among others, to display aspects of a number. You can assign specific sets of attributes for positive and negative numbers, and for specific cases including 0, NaN, and nil
...
+ (void)
setDefaultFormatterBehavior: (
NSNumberFormatterBehavior )behavior;
Availability: MacOS-X 10.4.0
Sets the default behavior of number
formatters. NB. If GNUstep has been
built without the ICU library,
NSNumberFormatterBehavior10_0
is currently used irrespective of this setting.
- (BOOL)
allowsFloats ;
Availability: MacOS-X 10.0.0
Returns whether number parsing will accept floating
point values or generate an exception (only
int values are valid). Default is
YES
.
- (BOOL)
alwaysShowsDecimalSeparator ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSAttributedString *)
attributedStringForNil ;
Availability: MacOS-X 10.0.0
Returns the exact attributed string used for
nil
values. By default this is an empty
string.
- (
NSAttributedString *)
attributedStringForNotANumber ;
Availability: MacOS-X 10.0.0
Returns the exact attributed string used for NaN
values. By default this is the string "NaN" with no
attributes.
- (
NSAttributedString *)
attributedStringForZero ;
Availability: MacOS-X 10.0.0
Returns the exact attributed string used for zero
values. By default this is based on the format for
zero values, if set, or the format for positive values
otherwise.
- (
NSString *)
currencyCode ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSString *)
currencyDecimalSeparator ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSString *)
currencyGroupingSeparator ;
Availability: MacOS-X 10.5.0
Description forthcoming.
- (
NSString *)
currencySymbol ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSString *)
decimalSeparator ;
Availability: MacOS-X 10.0.0
Returns thousands separator used; default is '.'.
- (
NSString *)
exponentSymbol ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSString *)
format ;
Availability: MacOS-X 10.0.0
Returns the format string this instance was
initialized with.
- (
NSUInteger )
formatWidth ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSNumberFormatterBehavior )
formatterBehavior ;
Availability: MacOS-X 10.4.0
Returns the behavior of the receiver, either the
default behavior set for number formatters, or the
behavior specified by an earlier call to the
-setFormatterBehavior:
method.
- (BOOL)
generatesDecimalNumbers ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (BOOL)
getObjectValue: (out id*)anObject
forString: (
NSString *)aString
range: (
NSRange *)rangep
error: (out
NSError **)error;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSString *)
groupingSeparator ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSUInteger )
groupingSize ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (BOOL)
hasThousandSeparators ;
Availability: MacOS-X 10.0.0
Returns whether thousands separator should be used,
regardless of whether it is set in format.
(Default is YES
if explicitly set in
format.)
- (
NSString *)
internationalCurrencySymbol ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (BOOL)
isLenient ;
Availability: MacOS-X 10.5.0
Description forthcoming.
- (BOOL)
isPartialStringValidationEnabled ;
Availability: MacOS-X 10.5.0
Description forthcoming.
- (
NSLocale *)
locale ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (BOOL)
localizesFormat ;
Availability: MacOS-X 10.0.0
Returns whether this format should defer to the
locale in determining thousands separator and
decimal point. The default is to NOT localize.
- (
NSNumber *)
maximum ;
Availability: MacOS-X 10.0.0
Returns maximum value that will be accepted as
valid in number parsing. Default is none.
- (
NSUInteger )
maximumFractionDigits ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSUInteger )
maximumIntegerDigits ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSUInteger )
maximumSignificantDigits ;
Availability: MacOS-X 10.5.0
Description forthcoming.
- (
NSNumber *)
minimum ;
Availability: MacOS-X 10.0.0
Returns minimum value that will be accepted as
valid in number parsing. Default is none.
- (
NSUInteger )
minimumFractionDigits ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSUInteger )
minimumIntegerDigits ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSUInteger )
minimumSignificantDigits ;
Availability: MacOS-X 10.5.0
Description forthcoming.
- (
NSString *)
minusSign ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSNumber *)
multiplier ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSString *)
negativeFormat ;
Availability: MacOS-X 10.0.0
Returns format used for negative numbers.
- (
NSString *)
negativeInfinitySymbol ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSString *)
negativePrefix ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSString *)
negativeSuffix ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSString *)
nilSymbol ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSString *)
notANumberSymbol ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSNumber *)
numberFromString: (
NSString *)string;
Availability: MacOS-X 10.4.0
Returns the number for this string .
- (
NSString *)
paddingCharacter ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSString *)
perMillSymbol ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSString *)
percentSymbol ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSString *)
plusSign ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSString *)
positiveFormat ;
Availability: MacOS-X 10.0.0
Returns format used for positive numbers.
- (
NSString *)
positiveInfinitySymbol ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSString *)
positivePrefix ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSString *)
positiveSuffix ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSNumber *)
roundingIncrement ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSUInteger )
secondaryGroupingSize ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setAllowsFloats: (BOOL)flag;
Availability: MacOS-X 10.0.0
Sets whether number parsing will accept floating point
values or generate an exception (only
int values are valid). Default is
YES
.
- (void)
setAlwaysShowsDecimalSeparator: (BOOL)flag;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setAttributedStringForNil: (
NSAttributedString *)newAttributedString;
Availability: MacOS-X 10.0.0
Sets the exact attributed string used for
nil
values. By default this is an empty
string.
- (void)
setAttributedStringForNotANumber: (
NSAttributedString *)newAttributedString;
Availability: MacOS-X 10.0.0
Sets the exact attributed string used for NaN values.
By default this is the string "NaN" with no attributes.
- (void)
setAttributedStringForZero: (
NSAttributedString *)newAttributedString;
Availability: MacOS-X 10.0.0
Sets the exact attributed string used for zero values.
By default this is based on the format for zero values,
if set, or the format for positive values otherwise.
- (void)
setCurrencyCode: (
NSString *)string;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setCurrencyDecimalSeparator: (
NSString *)string;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setCurrencyGroupingSeparator: (
NSString *)string;
Availability: MacOS-X 10.5.0
Description forthcoming.
- (void)
setCurrencySymbol: (
NSString *)string;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setDecimalSeparator: (
NSString *)newSeparator;
Availability: MacOS-X 10.0.0
Sets thousands separator used; default is '.'.
- (void)
setExponentSymbol: (
NSString *)string;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setFormat: (
NSString *)aFormat;
Availability: MacOS-X 10.0.0
Sets format string. See class description for more
information.
- (void)
setFormatWidth: (
NSUInteger )number;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setFormatterBehavior: (
NSNumberFormatterBehavior )behavior;
Availability: MacOS-X 10.4.0
Sets the behavior of the formatter.
NB. If GNUstep has been built without the ICU library,
NSNumberFormatterBehavior10_0
is currently used irrespective of this setting.
- (void)
setGeneratesDecimalNumbers: (BOOL)flag;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setGroupingSeparator: (
NSString *)string;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setGroupingSize: (
NSUInteger )number;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setHasThousandSeparators: (BOOL)flag;
Availability: MacOS-X 10.0.0
Sets whether thousands separator should be used,
regardless of whether it is set in format.
(Default is YES
if explicitly set in
format.)
- (void)
setInternationalCurrencySymbol: (
NSString *)string;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setLenient: (BOOL)flag;
Availability: MacOS-X 10.5.0
Description forthcoming.
- (void)
setLocale: (
NSLocale *)locale;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setLocalizesFormat: (BOOL)flag;
Availability: MacOS-X 10.0.0
Set whether this format should defer to the locale in
determining thousands separator and decimal
point. The default is to NOT localize.
- (void)
setMaximum: (
NSNumber *)aMaximum;
Availability: MacOS-X 10.0.0
Sets maximum value that will be accepted as valid in
number parsing. Default is none.
- (void)
setMaximumFractionDigits: (
NSUInteger )number;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setMaximumIntegerDigits: (
NSUInteger )number;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setMaximumSignificantDigits: (
NSUInteger )number;
Availability: MacOS-X 10.5.0
Description forthcoming.
- (void)
setMinimum: (
NSNumber *)aMinimum;
Availability: MacOS-X 10.0.0
Sets minimum value that will be accepted as valid in
number parsing. Default is none.
- (void)
setMinimumFractionDigits: (
NSUInteger )number;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setMinimumIntegerDigits: (
NSUInteger )number;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setMinimumSignificantDigits: (
NSUInteger )number;
Availability: MacOS-X 10.5.0
Description forthcoming.
- (void)
setMinusSign: (
NSString *)string;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setMultiplier: (
NSNumber *)number;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setNegativeFormat: (
NSString *)aFormat;
Availability: MacOS-X 10.0.0
Sets format used for negative numbers. See class
description for more information.
- (void)
setNegativeInfinitySymbol: (
NSString *)string;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setNegativePrefix: (
NSString *)string;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setNegativeSuffix: (
NSString *)string;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setNilSymbol: (
NSString *)string;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setNotANumberSymbol: (
NSString *)string;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setPaddingCharacter: (
NSString *)string;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setPartialStringValidationEnabled: (BOOL)enabled;
Availability: MacOS-X 10.5.0
Description forthcoming.
- (void)
setPerMillSymbol: (
NSString *)string;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setPercentSymbol: (
NSString *)string;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setPlusSign: (
NSString *)string;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setPositiveFormat: (
NSString *)aFormat;
Availability: MacOS-X 10.0.0
Sets format used for positive numbers. See class
description for more information.
- (void)
setPositiveInfinitySymbol: (
NSString *)string;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setPositivePrefix: (
NSString *)string;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setPositiveSuffix: (
NSString *)string;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setRoundingIncrement: (
NSNumber *)number;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setSecondaryGroupingSize: (
NSUInteger )number;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setTextAttributesForNegativeInfinity: (
NSDictionary *)newAttributes;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setTextAttributesForNegativeValues: (
NSDictionary *)newAttributes;
Availability: MacOS-X 10.0.0
- (void)
setTextAttributesForNil: (
NSDictionary *)newAttributes;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setTextAttributesForNotANumber: (
NSDictionary *)newAttributes;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setTextAttributesForPositiveInfinity: (
NSDictionary *)newAttributes;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setTextAttributesForPositiveValues: (
NSDictionary *)newAttributes;
Availability: MacOS-X 10.0.0
- (void)
setTextAttributesForZero: (
NSDictionary *)newAttributes;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setThousandSeparator: (
NSString *)newSeparator;
Availability: MacOS-X 10.0.0
Sets thousands separator used; default is ','.
- (void)
setUsesGroupingSeparator: (BOOL)flag;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (void)
setUsesSignificantDigits: (BOOL)flag;
Availability: MacOS-X 10.5.0
Description forthcoming.
- (void)
setZeroSymbol: (
NSString *)string;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSString *)
stringFromNumber: (
NSNumber *)number;
Availability: MacOS-X 10.4.0
Returns the string version of this
number based on the format specified.
- (
NSDictionary *)
textAttributesForNegativeInfinity ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSDictionary *)
textAttributesForNegativeValues ;
Availability: MacOS-X 10.0.0
- (
NSDictionary *)
textAttributesForNil ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSDictionary *)
textAttributesForNotANumber ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSDictionary *)
textAttributesForPositiveInfinity ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSDictionary *)
textAttributesForPositiveValues ;
Availability: MacOS-X 10.0.0
- (
NSDictionary *)
textAttributesForZero ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (
NSString *)
thousandSeparator ;
Availability: MacOS-X 10.0.0
Returns thousands separator used; default is ','.
- (BOOL)
usesGroupingSeparator ;
Availability: MacOS-X 10.4.0
Description forthcoming.
- (BOOL)
usesSignificantDigits ;
Availability: MacOS-X 10.5.0
Description forthcoming.
- (
NSString *)
zeroSymbol ;
Availability: MacOS-X 10.4.0
Description forthcoming.
Up