|
WebObjects 5.4.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.text.Format
com.webobjects.foundation.NSNumberFormatter
public class NSNumberFormatter
NSNumberFormatter converts between java.lang.Number and textual representations of numeric values. The representation encompasses integers and floating-point numbers; floating-point numbers can be formatted to a specified decimal position. NSNumberFormatters can also impose ranges on the numeric values that can be formatted.
You can associate a number pattern with a WOString or WOTextField dynamic element. WebObjects uses an NSNumberFormatter object to perform the appropriate conversions.
Instances of NSNumberFormatter are mutable, so caution should be exercised when sharing them.
The most common technique for creating an NSNumberFormatter is to use the one-argument constructor, which takes as its argument a string whose contents can be one of the following:
"$###,##0.00"
(the syntax of format strings is discussed in the following section).
"###,##0.00;(###,##0.00)"
.
"$###,###.00;0.00;($###,##0.00)"
. Note that zero patterns are treated as string constants.
As implied in the above list, you're only required to specify a pattern for positive values. If you don't specify a pattern for negative and zero values, a default pattern based on the positive value pattern is . used. For example, if your positive value pattern is "#,##0.00"
,
an input value of "0"
will be displayed as "0.00"
.
If you don't specify a pattern for negative values, the pattern specified for positive values is used, preceded by a minus sign (-
).
If you specify a separate pattern for negative values, its separators should be parallel to those specified in the positive pattern string. In NSNumberFormatter, separators are either enabled or disabled for all patterns -- both negative and positive patterns should therefore use the same approach.
As an alternative to using the one-argument constructor is to use the no-argument constructor and invoking setPattern with the pattern. You can also use the setPositivePattern and setNegativePattern methods.
Pattern strings can include the following types of characters:
Pattern strings can include numeric characters. Wherever a number is included in a pattern string, the number is displayed unless an input character in the same relative position overwrites it. For example, suppose for the positive pattern string "9,990.00"
, and the
value 53.88 is entered into a cell to which the pattern has been applied. The cell would display the value as 9,953.88.
Pattern strings can include the period character (.
) as a decimal separator, and comma character (,
) as a thousand separator. If you want to use different characters as separators, you can set them using the setDecimalSeparator and setThousandSeparator methods.
You use the pound sign character (#) to represent numeric characters that will be input by the user. For example, for the positive pattern "$#,##0.00"
, if the characters 76329 were entered into a cell to which the pattern has been applied, they would be displayed as
$76,329.00. Strictly speaking, however, you don't need to use placeholders. The format strings ",0.00"
, "#,#0.00"
, and "#,##0.00"
are functionally equivalent. In other words, including separator characters in a pattern
string signals NSNumberFormatter to use the separators, regardless of whether you use (or where you put) placeholders. The placeholder character's chief virtue lies in its ability to make pattern strings more human-readable, which is especially useful for displaying patterns in the user
interface.
To include a space in a pattern string, use the underscore character (_
). This character inserts a space if no numeric character has been input to occupy that position.
The dollar sign character ($
) is the canonical currency mark in pattern strings. If the setCurrencySymbol
method is used, the new currency symbol will be used whenever the presence of "$" in the pattern string implies the use of a currency symbol. Note that the
pattern string itself is not altered by changing the currency symbol.
All other characters specified in a pattern string are displayed as typed. The following table shows examples of the how the value 1019.55 is displayed for different positive patterns:
Pattern String | Display |
"#,##0.00" |
1,019.55 |
"$#,##0.00" |
$1,019.55 |
"___,__0.00" |
1,019.55 |
NSNumberFormatter supports two different kinds of separators: thousands and decimal. By default these separators are represented by the comma (,
) and period (.
) characters respectively. The default pattern ("#,##0.##
") enables them.
All of the following statements have the effect of enabling the thousands separator:
<blockquote> // use setPattern: numberFormatter.setPattern("#,###"); // use setHasThousandSeparators: numberFormatter.setHasThousandSeparators(true); // use setThousandSeparator: numberFormatter.setThousandSeparator("_"); </blockquote>
If you use the statement numberFormatter.setHasThousandSeparators(false),
it disables the thousands separator, even if you've set them through another means.
Both of the following statements have the effect of enabling decimal separators:
<blockquote> // use setFormat: numberFormatter.setFormat("0.00"); // use setDecimalSeparator: numberFormatter.setDecimalSeparator("-"); </blockquote>
When you enable or disable separators, it affects both positive and negative patterns. Consequently, both patterns must use the same separator scheme.
You can use the thousandSeparator and decimalSeparator methods to return a string containing the character the receiver uses to represent each separator. However, this shouldn't be taken as an indication of whether separators are enabled. Even when separators are disabled, an NSNumberFormatter still knows the characters it uses to represent separators.
Separators must be single characters. If multiple characters are specified in the arguments to setThousandSeparator and setDecimalSeparator, an IllegalArgumentException will be thrown.
You can't set the same character to represent thousand and decimal separators. If you try, the two separator characters will be swapped.
NSNumberFormatter provides methods to localize pattern strings. You can change the currency symbol, the decimal separator, and the thousands separator manually, or you can trust NSNumberFormatter to do it for you, based on locales. If you enable localization for an instance of NSNumberFormatter, it will check the current locale and localize pattern strings appropriately for that locale. By default, instances of NSNumberFormatter are not localized. You can enable localization for all new instances of NSNumberFormatter using setDefaultLocalizesPattern or for a specific instance of NSNumberFormatter using setLocalizesPattern.
The following code excerpt shows the three different approaches for setting an NSNumberFormatter object's format using setPattern
:
<blockquote> NSNumberFormatter numberFormatter = new NSNumberFormatter(); // specify just positive format numberFormatter.setPattern("$#,##0.00"); // specify positive and negative formats numberFormatter.setPattern("$#,##0.00;($#,##0.00)"); // specify positive, zero, and negative formats numberFormatter.setFormat("$#,###.00;0.00;($#,##0.00)"); </blockquote>
Format
,
NSNumberFormatter.thousandSeparator()
,
NSNumberFormatter.decimalSeparator()
,
NSNumberFormatter.roundingBehavior()
,
NSNumberFormatter.setPattern(java.lang.String)
,
NSNumberFormatter.setNegativePattern(java.lang.String)
,
NSNumberFormatter.setPositivePattern(java.lang.String)
,
NSNumberFormatter.setThousandSeparator(java.lang.String)
,
NSNumberFormatter.setDecimalSeparator(java.lang.String)
,
NSNumberFormatter.setThousandSeparator(java.lang.String)
,
NSNumberFormatter.setDecimalSeparator(java.lang.String)
,
NSNumberFormatter.setDefaultLocalizesPattern(boolean)
,
NSNumberFormatter.setLocalizesPattern(boolean)
,
NSNumberFormatter.setRoundingBehavior(int)
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class java.text.Format |
---|
Format.Field |
Field Summary | |
---|---|
static String |
DefaultPattern
The default pattern string used by the no-argument constructor: #,##0.## . |
static BigDecimal |
NSDecimalNotANumber
The constant BigDecimal object as a place holder for all numbers incapable of being represented as real numbers (NaN). |
static int |
RoundBankers
Rounding mode : Bankers. |
static int |
RoundDown
Rounding mode : Down. |
static int |
RoundPlain
Rounding mode : Plain. |
static int |
RoundUp
Rounding mode : Up. |
Constructor Summary | |
---|---|
NSNumberFormatter()
Creates an NSNumberFormatter and sets its pattern to the default pattern. |
|
NSNumberFormatter(String pattern)
Creates an NSFormatter and sets its pattern to pattern . |
Method Summary | |
---|---|
boolean |
allowsFloats()
Indicates whether this NSNumberFormatter allows floating-point values as input. |
String |
attributedStringForNil()
Deprecated. Use NSNumberFormatter.stringForNull() . |
String |
attributedStringForNotANumber()
Deprecated. Use NSNumberFormatter.stringForNotANumber() . |
String |
attributedStringForZero()
Deprecated. Use NSNumberFormatter.stringForZero() . |
static Locale[] |
availableLocales()
|
String |
currencySymbol()
|
String |
decimalSeparator()
Returns the current decimal separator character as a String. |
static Locale |
defaultLocale()
|
static boolean |
defaultLocalizesPattern()
Returns true to indicate that the pattern will be localized for all new instances of NSNumberFormatter in your application. |
String |
format()
Deprecated. Use NSNumberFormatter.pattern() . |
StringBuffer |
format(Object obj,
StringBuffer toAppendTo,
FieldPosition pos)
Formats obj to produce a string, appends the string to toAppendTo , and returns the resulting StringBuffer. |
boolean |
hasThousandSeparators()
Indicates whether this NSNumberFormatter's format includes a thousands separator. |
Locale |
locale()
|
boolean |
localizesFormat()
Deprecated. Use NSNumberFormatter.localizesPattern() . |
boolean |
localizesPattern()
Indicates whether this NSNumberFormatter's pattern is localized. |
BigDecimal |
maximum()
The default, no maximal value, is represented with the constant NSDecimalNotANumber . |
BigDecimal |
minimum()
The default, no minimum value, is represented with the constant NSDecimalNotANumber . |
String |
negativeFormat()
Deprecated. Use NSNumberFormatter.negativePattern() . |
String |
negativePattern()
|
Object |
objectValueForString(String inString)
Converts a string to a java.lang.Number using this NSNumberFormatter's pattern. |
Object |
parseObject(String source)
Parses a string to produce an object. |
Object |
parseObject(String source,
ParsePosition status)
Parses a string using the current pattern to produce a Number object. |
String |
pattern()
|
String |
positiveFormat()
Deprecated. Use NSNumberFormatter.positivePattern() . |
String |
positivePattern()
|
int |
roundingBehavior()
Provides the rounding behavior that this NSNumberFormatter uses. |
void |
setAllowsFloats(boolean allowsRealNumbers)
Sets whether this NSNumberFormatter allows as input floating-point values (that is, values that include the decimal-separator character). |
void |
setAttributedStringForNil(String newString)
Deprecated. Use NSNumberFormatter.setStringForNull(java.lang.String) . |
void |
setAttributedStringForNotANumber(String newString)
Deprecated. Use NSNumberFormatter.setStringForNotANumber(java.lang.String) . |
void |
setAttributedStringForZero(String newString)
Deprecated. Use NSNumberFormatter.setStringForZero(java.lang.String) . |
void |
setCurrencySymbol(String newSymbol)
Sets the string this NSNumberFormatter uses to represent currency. |
void |
setDecimalSeparator(String newSeparator)
Sets the first character of newSeparator as the decimal separator for this NSNumberFormatter If newSeparator is the current thousands' separator for this formatter, the thousands' separator and the decimal separator are swapped. |
static void |
setDefaultLocale(Locale newLocale)
Sets the default locale of this NSNumberFormatter. |
static void |
setDefaultLocalizesPattern(boolean newDefault)
Sets whether all new NSNumberFormatter instances should localize their patterns based on the locale. |
void |
setFormat(String pattern)
Deprecated. Use NSNumberFormatter.setPattern(java.lang.String) . |
void |
setHasThousandSeparators(boolean newThousandsUsage)
Sets whether this NSNumberFormatter uses a thousands separator. |
void |
setLocale(Locale newLocale)
Sets the locale of this NSNumberFormatter. |
void |
setLocalizesFormat(boolean doLocalization)
Deprecated. Use NSNumberFormatter.setLocalizesPattern(boolean) . |
void |
setLocalizesPattern(boolean newDefault)
Sets whether this NSNumberFormatter's pattern should be localized. |
void |
setMaximum(BigDecimal newMaximum)
Sets the highest number this NSNumberFormatter allows as input. |
void |
setMinimum(BigDecimal newMinimum)
Sets the minimum number this NSNumberFormatter allows as input. |
void |
setNegativeFormat(String pattern)
Deprecated. Use NSNumberFormatter.setNegativePattern(java.lang.String) |
void |
setNegativePattern(String pattern)
Sets the pattern this NSNumberFormatter uses to display negative numbers. |
void |
setPattern(String pattern)
Sets this NSNumberFormatter's pattern. |
void |
setPositiveFormat(String pattern)
Deprecated. Use NSNumberFormatter.setPositivePattern(java.lang.String) . |
void |
setPositivePattern(String pattern)
Sets the pattern this NSNumberFormatter uses to display positive numbers. |
void |
setRoundingBehavior(int newBehavior)
Sets this NSNumberFormatter's rounding behavior. |
void |
setStringForNotANumber(String newString)
Sets the string this NSNumberFormatter uses to display values that are incapable of being displayed as real numbers. |
void |
setStringForNull(String newString)
Sets the string this NSNumberFormatter uses to represent null values. |
void |
setStringForZero(String newString)
Sets the string this NSNumberFormatter uses to display zero values. |
void |
setThousandSeparator(String newSeparator)
Sets the first character of newSeparator as the thousands separator for this NSNumberFormatter If newSeparator is the current decimal separator for this formatter, the thousands' separator and the decimal separator are swapped. |
String |
stringForNotANumber()
Returns the string this NSNumberFormatter displays for numeric values incapable of being displayed as real numbers. |
String |
stringForNull()
Returns the string this NSNumberFormatter uses to display null values. |
String |
stringForObjectValue(Object inNumber)
Formats an object into a string using this NSNumberFormatter's pattern. |
String |
stringForZero()
Returns the zero-value string. |
String |
thousandSeparator()
Returns a string containing the single character this NSNumberFormatter uses to represent the thousands separator. |
Methods inherited from class java.text.Format |
---|
clone, format, formatToCharacterIterator |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int RoundDown
NSNumberFormatter.roundingBehavior()
,
NSNumberFormatter.setRoundingBehavior(int)
,
Constant Field Valuespublic static final int RoundUp
NSNumberFormatter.roundingBehavior()
,
NSNumberFormatter.setRoundingBehavior(int)
,
Constant Field Valuespublic static final int RoundPlain
NSNumberFormatter.roundingBehavior()
,
NSNumberFormatter.setRoundingBehavior(int)
,
Constant Field Valuespublic static final int RoundBankers
NSNumberFormatter.roundingBehavior()
,
NSNumberFormatter.setRoundingBehavior(int)
,
Constant Field Valuespublic static final String DefaultPattern
#,##0.##
.
NSNumberFormatter.roundingBehavior()
,
NSNumberFormatter.setRoundingBehavior(int)
,
Constant Field Valuespublic static final BigDecimal NSDecimalNotANumber
NSNumberFormatter.roundingBehavior()
,
NSNumberFormatter.setRoundingBehavior(int)
Constructor Detail |
---|
public NSNumberFormatter()
NSNumberFormatter.DefaultPattern
public NSNumberFormatter(String pattern)
pattern
.
pattern
- the format string
java.lang.IllegalArgumentException
- if the pattern is invalidNSNumberFormatter.setPattern(java.lang.String)
Method Detail |
---|
public String decimalSeparator()
"."
public void setDecimalSeparator(String newSeparator)
newSeparator
as the decimal separator for this NSNumberFormatter If newSeparator
is the current thousands' separator for this formatter, the thousands' separator and the decimal separator are swapped.
newSeparator
- the new decimal separator as a one character String
IllegalArgumentException
- newSeparator
is null
or not exactly one characterNSNumberFormatter.setPattern(java.lang.String)
,
NSNumberFormatter.setThousandSeparator(java.lang.String)
public String thousandSeparator()
public void setThousandSeparator(String newSeparator)
newSeparator
as the thousands separator for this NSNumberFormatter If newSeparator
is the current decimal separator for this formatter, the thousands' separator and the decimal separator are swapped. If using the thousands separator is
disabled through any other means (such as setPattern
), using this method enables them.
newSeparator
- the new thousand separator. It must be exactly 1 character.
IllegalArgumentException
- if newSeparator
is null
or not exactly one characterNSNumberFormatter.setPattern(java.lang.String)
,
NSNumberFormatter.setDecimalSeparator(java.lang.String)
public int roundingBehavior()
NSNumberFormatter.RoundDown
,
NSNumberFormatter.RoundUp
,
NSNumberFormatter.RoundPlain
,
NSNumberFormatter.RoundBankers
public void setRoundingBehavior(int newBehavior)
newBehavior
- the rounding behavior to use
IllegalArgumentException
- newRoundingBehavior
not validNSNumberFormatter.roundingBehavior()
public String stringForZero()
public void setStringForZero(String newString)
newString
- the string representing zero valuespublic String stringForNull()
null
values. By default, null
values are displayed as an empty string.
null
valuespublic void setStringForNull(String newString)
null
values.
newString
- the string representing null
values
IllegalArgumentException
- if newString
is null
public String stringForNotANumber()
NSNumberFormatters use the constant NSDecimalNotANumber
to represent such numbers as BigDecimals.
public void setStringForNotANumber(String newString)
NSNumberFormatters use the constant NSDecimalNotANumber
to represent such numbers. NSDecimalNotANumber
is a java.math.BigDecimal object.
By default, imaginary numbers are represented with the string "NaN
".
newString
- the string used for numbers outside the set of real numbers.
IllegalArgumentException
- if newString
is null
@Deprecated public String attributedStringForZero()
NSNumberFormatter.stringForZero()
.
stringForZero
@Deprecated public void setAttributedStringForZero(String newString)
NSNumberFormatter.setStringForZero(java.lang.String)
.
newString
- the input string@Deprecated public String attributedStringForNil()
NSNumberFormatter.stringForNull()
.
stringForNull
@Deprecated public void setAttributedStringForNil(String newString)
NSNumberFormatter.setStringForNull(java.lang.String)
.
newString
- setStringForNull
@Deprecated public String attributedStringForNotANumber()
NSNumberFormatter.stringForNotANumber()
.
stringForNotANumber
@Deprecated public void setAttributedStringForNotANumber(String newString)
NSNumberFormatter.setStringForNotANumber(java.lang.String)
.
newString
- the input stringpublic boolean hasThousandSeparators()
true
if a thousands separator is used.public void setHasThousandSeparators(boolean newThousandsUsage)
newThousandsUsage
is false
, the thousands separator is disabled for both positive and negative formats (even if it is set through other means, such as setPattern
). When
newThousandsUsage
is true
, a thousands separator is used.
newThousandsUsage
- true
for this NSNumberFormatter to use a thousands separatorNSNumberFormatter.setPattern(java.lang.String)
public boolean allowsFloats()
true
if this NSNumberFormatter allows as input floating-point values (that is, values that include the period character (.))public void setAllowsFloats(boolean allowsRealNumbers)
allowsRealNumbers
- true
to allow floating-point numberspublic BigDecimal minimum()
NSDecimalNotANumber
.
NSDecimalNotANumber
if no lower bound exists.public void setMinimum(BigDecimal newMinimum)
NSDecimalNotANumber
.
newMinimum
- the lowest number allowable, or NSDecimalNotANumber
to remove the minimum.
IllegalArgumentException
- if newMinimum
is null
public BigDecimal maximum()
NSDecimalNotANumber
.
NSDecimalNotANumber
if no upper bound exists.public void setMaximum(BigDecimal newMaximum)
NSDecimalNotANumber
.
newMaximum
- the highest number allowable, or NSDecimalNotANumber
to remove the maximum
IllegalArgumentException
- newMaximum
is null
public String negativePattern()
NSNumberFormatter.setNegativePattern(java.lang.String)
,
NSNumberFormatter.setPattern(java.lang.String)
public void setNegativePattern(String pattern)
pattern
- the pattern to use to display negative numbers
IllegalArgumentException
- pattern
is null
, empty, or does not contain any of the characters in the string ",._#0123456789".NSNumberFormatter.setPattern(java.lang.String)
,
NSNumberFormatter.setPositivePattern(java.lang.String)
public String positivePattern()
NSNumberFormatter.setPattern(java.lang.String)
,
NSNumberFormatter.setPositivePattern(java.lang.String)
public void setPositivePattern(String pattern)
pattern
- the pattern to use to display positive numbers
IllegalArgumentException
- pattern
is null
, empty, or doesn't contain any of the characters in the string ",._#0123456789".NSNumberFormatter.setPattern(java.lang.String)
,
NSNumberFormatter.setNegativePattern(java.lang.String)
public String pattern()
NSNumberFormatter.setPattern(java.lang.String)
public void setPattern(String pattern)
";"
. The first part of the string represents the positive pattern, the second part of the string represents the zero value, and the last part of the string
represents the negative pattern. If the string has just two parts, the first one becomes the positive pattern, and the second one becomes the negative pattern. If the string has just one part, it becomes the positive pattern, and default formats are provided for zero and negative values based
on the positive format. The following code excerpt shows the three different approaches for setting an NSNumberFormatter object's format using setPattern:NSNumberFormatter numberFormatter = new NSNumberFormatter(); numberFormatter.setPattern("$#,##0.00"); // specify just positive format numberFormatter.setPattern("$#,##0.00;($#,##0.00)"); // specify positive and negative formats numberFormatter.setPattern("$#,###.00;0.00;($#,##0.00)"); // specify positive, zero, and negative formats
pattern
- the format in which the object is to be formatted
IllegalArgumentException
- if the pattern is null
, invalid, or has more than 3 segments.NSNumberFormatter.pattern()
@Deprecated public String negativeFormat()
NSNumberFormatter.negativePattern()
.
negativePattern
@Deprecated public void setNegativeFormat(String pattern)
NSNumberFormatter.setNegativePattern(java.lang.String)
pattern
- the new pattern@Deprecated public String positiveFormat()
NSNumberFormatter.positivePattern()
.
positivePattern
@Deprecated public void setPositiveFormat(String pattern)
NSNumberFormatter.setPositivePattern(java.lang.String)
.
pattern
- the new pattern this NSNumberFormatter is to use to display positive numbers@Deprecated public String format()
NSNumberFormatter.pattern()
.
pattern
NSNumberFormatter.pattern()
@Deprecated public void setFormat(String pattern)
NSNumberFormatter.setPattern(java.lang.String)
.
pattern
- the new input pattern@Deprecated public boolean localizesFormat()
NSNumberFormatter.localizesPattern()
.
true
if this formatter localizes its pattern String@Deprecated public void setLocalizesFormat(boolean doLocalization)
NSNumberFormatter.setLocalizesPattern(boolean)
.
doLocalization
- true
if this formatter should localize its pattern String, otherwise false
public String stringForObjectValue(Object inNumber) throws IllegalArgumentException
java.text.Format.format
inNumber
- the java.lang.Number object to be formatted
IllegalArgumentException
- inNumber
is not a java.lang.NumberFormat.format(Object obj)
,
NSNumberFormatter.objectValueForString(java.lang.String)
public Object objectValueForString(String inString) throws ParseException
java.Text.Format.parseObject
inString
- string containing a numeric value to be parsed
ParseException
- conversion failureFormat.parseObject(String source)
,
NSNumberFormatter.stringForObjectValue(java.lang.Object)
public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos)
obj
to produce a string, appends the string to toAppendTo
, and returns the resulting StringBuffer. The pos
parameter specifies an alignment field to place the formatted object. When the method returns, this parameter contains the position
of the alignment field.
format
in class Format
obj
- the input object to be appended totoAppendTo
- the string to be appendedpos
- where the formatted field is to be placed
NSNumberFormatter.stringForObjectValue(java.lang.Object)
public Object parseObject(String source, ParsePosition status)
parseObject
in class Format
source
- the input stringstatus
- the position where to parse
NSNumberFormatter.objectValueForString(java.lang.String)
public Object parseObject(String source) throws ParseException
parseObject
in class Format
source
- the input string
ParseException
NSTimestampFormatter.setDefaultParseTimeZone(com.webobjects.foundation.NSTimeZone)
,
NSNumberFormatter.objectValueForString(java.lang.String)
public static Locale[] availableLocales()
NumberFormat.getAvailableLocales()
public static Locale defaultLocale()
Locale
,
Locale.getDefault()
public static void setDefaultLocale(Locale newLocale)
newLocale
- the new default locale of this NSNumberFormatter
IllegalArgumentException
- newLocale
is null
Locale
public Locale locale()
Locale
public void setLocale(Locale newLocale)
setLocalizesPattern(true)
is invoked.
newLocale
- the new locale to be set as the locale of this NSNumberFormatter
IllegalArgumentException
- newLocale is null
Locale
public static boolean defaultLocalizesPattern()
true
if new instances of NSNumberFormatter use localized patternsNSNumberFormatter.setDefaultLocalizesPattern(boolean)
,
DecimalFormatSymbols
public static void setDefaultLocalizesPattern(boolean newDefault)
newDefault
- NSNumberFormatter.defaultLocalizesPattern()
,
DecimalFormatSymbols
public boolean localizesPattern()
true
when this NSNumberFormatter's format uses localizationDecimalFormatSymbols
public void setLocalizesPattern(boolean newDefault)
newDefault
is true
, NSNumberFormatter chooses the appropriate currency symbol, thousands separator, string for zero, and string for NaN based on locale By default, NSNumberFormatters are not
localized.
newDefault
- true
to localize this NSNumberFormatterDecimalFormatSymbols
public String currencySymbol()
NSNumberFormatter.setCurrencySymbol(java.lang.String)
,
DecimalFormatSymbols
public void setCurrencySymbol(String newSymbol)
newSymbol
- the input symbolNSNumberFormatter.currencySymbol()
,
DecimalFormatSymbols
|
Last updated June 2008 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |