public class ERXNumberFormatter extends NSNumberFormatter
(/1024=)0.00 KB
which will divide the actual value by 1024 or
(*60;4=)0.00
which will multiply the actual value by 60.
When used for parsing, the resulting value will be scaled to a scale of 4.
So when the real value is 0.0165, the display value will be 0.99 and
when this is re-entered, the resulting value will again be 0.0165.Format.Field
Modifier and Type | Field and Description |
---|---|
protected static String |
DefaultKey |
_CLASS, _CurrencyPattern, _DecimalPattern, _IntegerPattern, DefaultPattern, NSDecimalNotANumber, RoundBankers, RoundDown, RoundPlain, RoundUp
Constructor and Description |
---|
ERXNumberFormatter() |
ERXNumberFormatter(String pattern)
Public constructor
|
Modifier and Type | Method and Description |
---|---|
static Format |
defaultNumberFormatterForObject(Object object) |
StringBuffer |
format(Object value,
StringBuffer buffer,
FieldPosition position)
Overridden to perform optional conversions on the value given.
|
static NSNumberFormatter |
numberFormatterForPattern(String pattern)
Returns a shared instance for the specified pattern.
|
Object |
parseObject(String aString)
Strips out the ignored characters and optionally performs an operation on the value
from the string to be parsed.
|
protected BigDecimal |
performFormat(BigDecimal value)
Override this in your subclass to provide for other operations when formatting a value.
|
protected BigDecimal |
performParse(BigDecimal value)
Override this in your subclass to provide for other operations when parsing a value.
|
protected void |
setFactor(BigDecimal value) |
void |
setIgnoredChars(String value) |
static void |
setNumberFormatterForPattern(NSNumberFormatter formatter,
String pattern)
Sets a shared instance for the specified pattern.
|
protected void |
setOperator(String value) |
void |
setPattern(String pattern)
Overridden to search the pattern for operators and factors.
|
protected void |
setScale(Integer value) |
void |
setStringForNegativeInfinity(String newString) |
void |
setStringForPositiveInfinity(String newString) |
static NSNumberFormatter |
sharedInstance()
Returns the default shared instance
|
String |
stringForNegativeInfinity() |
String |
stringForPositiveInfinity() |
allowsFloats, attributedStringForNil, attributedStringForNotANumber, attributedStringForZero, availableLocales, currencySymbol, decimalSeparator, defaultLocale, defaultLocalizesPattern, format, hasThousandSeparators, locale, localizesFormat, localizesPattern, maximum, minimum, negativeFormat, negativePattern, objectValueForString, parseObject, pattern, positiveFormat, positivePattern, roundingBehavior, setAllowsFloats, setAttributedStringForNil, setAttributedStringForNotANumber, setAttributedStringForZero, setCurrencySymbol, setDecimalSeparator, setDefaultLocale, setDefaultLocalizesPattern, setFormat, setHasThousandSeparators, setLocale, setLocalizesFormat, setLocalizesPattern, setMaximum, setMinimum, setNegativeFormat, setNegativePattern, setPositiveFormat, setPositivePattern, setRoundingBehavior, setStringForNotANumber, setStringForNull, setStringForZero, setThousandSeparator, stringForNotANumber, stringForNull, stringForObjectValue, stringForZero, thousandSeparator
clone, format, formatToCharacterIterator
protected static final String DefaultKey
public ERXNumberFormatter(String pattern)
public ERXNumberFormatter()
public static NSNumberFormatter sharedInstance()
public static Format defaultNumberFormatterForObject(Object object)
object
- public static NSNumberFormatter numberFormatterForPattern(String pattern)
public static void setNumberFormatterForPattern(NSNumberFormatter formatter, String pattern)
public void setIgnoredChars(String value)
protected void setFactor(BigDecimal value)
protected void setOperator(String value)
protected void setScale(Integer value)
public void setPattern(String pattern)
'(' . operatorChar . factor . [';' scale ] . '=)' normalFormatterString
setPattern
in class NSNumberFormatter
NSNumberFormatter.setPattern(java.lang.String)
protected BigDecimal performFormat(BigDecimal value)
value
- protected BigDecimal performParse(BigDecimal value)
value
- public Object parseObject(String aString) throws ParseException
parseObject
in class NSNumberFormatter
aString
- to be parsedParseException
public StringBuffer format(Object value, StringBuffer buffer, FieldPosition position)
format
in class NSNumberFormatter
Format.format(java.lang.Object, java.lang.StringBuffer, java.text.FieldPosition)
public String stringForNegativeInfinity()
public void setStringForNegativeInfinity(String newString)
public String stringForPositiveInfinity()
public void setStringForPositiveInfinity(String newString)
Copyright © 2002 – 2024 Project Wonder.