com.mizar.commons.math.util
Class EnglishNumberUtils

java.lang.Object
  extended by com.mizar.commons.math.util.EnglishNumberUtils

public class EnglishNumberUtils
extends java.lang.Object


Constructor Summary
protected EnglishNumberUtils()
           
 
Method Summary
static java.lang.String englishNumber(int integer)
           
static java.lang.String englishNumber(int integer, boolean ordinal)
           
static java.lang.String englishOrdinal(int integer)
           
static java.lang.String getOrdinal(int integer)
           
static java.lang.String getOrdinal(long along)
           
static java.lang.String getOrdinal(java.lang.Long num)
          Creates the trailing ordinal for numbers.
static java.lang.String getOrdinal(java.lang.String englishNumber)
          If the englishNumber cannot be interpreted as a valid english number then it is returned unchanged.
static void main(java.lang.String[] args)
           
static java.lang.Integer parseNumberString(java.lang.String englishNumber)
          If the englishNumber cannot be interpreted as a valid english number then a null is returned We only support numbers from one to ninety-nine hundred and ninety-nine
static java.lang.Integer parseOrdinal(java.lang.String ordinal)
           
static java.lang.String parseOrdinalString(java.lang.String englishNumber)
          If the englishNumber cannot be interpreted as a valid english number then a null is returned We only support numbers from one to ninety-nine hundred and ninety-nine
static java.lang.String renderOrdinal(int integer)
           
static java.lang.String renderOrdinal(java.lang.Integer integer)
           
static java.lang.String unpack(java.lang.String needsSpace)
           
static java.lang.String unpack(java.lang.String needsSeparator, java.lang.String separator)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnglishNumberUtils

protected EnglishNumberUtils()
Method Detail

main

public static void main(java.lang.String[] args)

unpack

public static java.lang.String unpack(java.lang.String needsSpace)

unpack

public static java.lang.String unpack(java.lang.String needsSeparator,
                                      java.lang.String separator)

englishNumber

public static java.lang.String englishNumber(int integer,
                                             boolean ordinal)

englishNumber

public static java.lang.String englishNumber(int integer)

englishOrdinal

public static java.lang.String englishOrdinal(int integer)

parseOrdinal

public static java.lang.Integer parseOrdinal(java.lang.String ordinal)

renderOrdinal

public static java.lang.String renderOrdinal(java.lang.Integer integer)

renderOrdinal

public static java.lang.String renderOrdinal(int integer)

getOrdinal

public static java.lang.String getOrdinal(java.lang.Long num)
Creates the trailing ordinal for numbers. ie, it creates '1st' if given 1.

Parameters:
num - number to generate the ordinal for
Returns:
string with just the ordinal, not the number.

getOrdinal

public static java.lang.String getOrdinal(long along)
Parameters:
along -
Returns:
See Also:
getOrdinal(Long num)

getOrdinal

public static java.lang.String getOrdinal(int integer)
Parameters:
integer -
Returns:
See Also:
getOrdinal(Long num)

getOrdinal

public static java.lang.String getOrdinal(java.lang.String englishNumber)
If the englishNumber cannot be interpreted as a valid english number then it is returned unchanged. We only support numbers from one to ninety-nine hundred and ninety-nine

Parameters:
englishNumber - a text string such as "THIRTY THIRD" or "THIRTY THREE" or "Thirty-third"
Returns:
in the case above the returned value would be 33rd

parseNumberString

public static java.lang.Integer parseNumberString(java.lang.String englishNumber)
If the englishNumber cannot be interpreted as a valid english number then a null is returned We only support numbers from one to ninety-nine hundred and ninety-nine

Parameters:
englishNumber - a text string such as "THIRTY THIRD" or "THIRTY THREE" or "Thirty-third"
Returns:
in the case above the returned value would be 33

parseOrdinalString

public static java.lang.String parseOrdinalString(java.lang.String englishNumber)
If the englishNumber cannot be interpreted as a valid english number then a null is returned We only support numbers from one to ninety-nine hundred and ninety-nine

Parameters:
englishNumber - a text string such as "THIRTY THIRD" or "THIRTY THREE" or "Thirty-third"
Returns:
in the case above the returned value would be 33rd