Package ipsk.text
Class NaturalNumberFormat
- java.lang.Object
- 
- java.text.Format
- 
- java.text.NumberFormat
- 
- ipsk.text.NaturalNumberFormat
 
 
 
- 
- All Implemented Interfaces:
- java.io.Serializable,- java.lang.Cloneable
 
 public class NaturalNumberFormat extends java.text.NumberFormatText format for natural numbers.- Author:
- klausj
- See Also:
- Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor Description NaturalNumberFormat(int digitCount)Create natural number format.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringBufferformat(double number, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)java.lang.StringBufferformat(long number, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)java.lang.Numberparse(java.lang.String source, java.text.ParsePosition parsePosition)- 
Methods inherited from class java.text.NumberFormatclone, equals, format, format, format, getAvailableLocales, getCurrency, getCurrencyInstance, getCurrencyInstance, getInstance, getInstance, getIntegerInstance, getIntegerInstance, getMaximumFractionDigits, getMaximumIntegerDigits, getMinimumFractionDigits, getMinimumIntegerDigits, getNumberInstance, getNumberInstance, getPercentInstance, getPercentInstance, getRoundingMode, hashCode, isGroupingUsed, isParseIntegerOnly, parse, parseObject, setCurrency, setGroupingUsed, setMaximumFractionDigits, setMaximumIntegerDigits, setMinimumFractionDigits, setMinimumIntegerDigits, setParseIntegerOnly, setRoundingMode
 
- 
 
- 
- 
- 
Constructor Detail- 
NaturalNumberFormatpublic NaturalNumberFormat(int digitCount) Create natural number format. Similar to classDecimalFormatbut accepts only natural numbers. The parser is strict and accepts only strings containing only number characters and the same length as the specified number of digits. Examples: nnFmt=NaturalNumberFormat(4) nnFmt.format(47); => "0047" nnFmt.parse("0048"); => 48 nnFmt.parse("00048"); throwsParserException!- Parameters:
- digitCount- number of digits
 
 
- 
 - 
Method Detail- 
formatpublic java.lang.StringBuffer format(double number, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)- Specified by:
- formatin class- java.text.NumberFormat
 
 - 
formatpublic java.lang.StringBuffer format(long number, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)- Specified by:
- formatin class- java.text.NumberFormat
 
 - 
parsepublic java.lang.Number parse(java.lang.String source, java.text.ParsePosition parsePosition)- Specified by:
- parsein class- java.text.NumberFormat
 
 
- 
 
-