PenProfile 2.x

com.livescribe.i18n
Class Formatter

java.lang.Object
  extended by com.livescribe.i18n.Formatter

public final class Formatter
extends Object


Field Summary
static int DATE_LONG
           
static int DATE_SHORT
           
static int DATETIME_LONG
           
static int DATETIME_NATURAL
           
static int DATETIME_SHORT
           
static int TIME_LONG
           
static int TIME_SHORT
           
 
Method Summary
 String formatCurrency(double number)
           
 String formatCurrency(double number, String currencyCode)
           
 String formatDateTime(Calendar dateTime, int style)
           
 String formatDateTime(Calendar dateTime, String format)
           
 String formatNumber(double number)
           
 String formatNumber(double number, int decimals)
           
 String formatNumber(long number)
           
 String formatPercentage(float number, int decimals)
           
 String formatPercentage(long value)
           
 String getDecimalPointSymbol()
          Get the decimal point symbol.
 String getDigitGroupingSymbol()
          Get the digit grouping symbol.
 String getFormat(int style)
           
static Formatter getFormatter()
           
static Formatter getFormatter(Locale locale)
           
 Locale getLocale()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATETIME_NATURAL

public static final int DATETIME_NATURAL
See Also:
Constant Field Values

DATETIME_LONG

public static final int DATETIME_LONG
See Also:
Constant Field Values

DATETIME_SHORT

public static final int DATETIME_SHORT
See Also:
Constant Field Values

DATE_LONG

public static final int DATE_LONG
See Also:
Constant Field Values

DATE_SHORT

public static final int DATE_SHORT
See Also:
Constant Field Values

TIME_LONG

public static final int TIME_LONG
See Also:
Constant Field Values

TIME_SHORT

public static final int TIME_SHORT
See Also:
Constant Field Values
Method Detail

getFormatter

public static Formatter getFormatter(Locale locale)

getFormatter

public static Formatter getFormatter()

getDigitGroupingSymbol

public String getDigitGroupingSymbol()
Get the digit grouping symbol.

Returns:
the string represents the digit grouping symbol.

getDecimalPointSymbol

public String getDecimalPointSymbol()
Get the decimal point symbol.

Returns:
the string represents the decimal point symbol.

formatCurrency

public String formatCurrency(double number)

formatCurrency

public String formatCurrency(double number,
                             String currencyCode)

getFormat

public String getFormat(int style)
Parameters:
style - DATETIME_NATURAL,DATETIME_LONG,DATETIME_SHORT,DATE_LONG,DATE_SHORT,TIME_LONG or TIME_SHORT
Returns:
the localized format string for the style passed in, in accordance with user preferences

formatDateTime

public String formatDateTime(Calendar dateTime,
                             int style)

formatDateTime

public String formatDateTime(Calendar dateTime,
                             String format)
Parameters:
dateTime -
format -
Returns:
Format string: a a/p aa am/pm H,h,K,k,m,s,d specify the format twice to indicate 2 digits, example m would be "5", mm would be "05" h hour in am/pm 1-12 H hour in day 0-23 k hour in day 1-24 K hour in am/pm 0-11 m minute 0-59 s second 0-59 d day in month (number) EE day in week short "Mon" EEEE day in week long "Monday" M month in year (number) MM month in year (number 2 digits) MMM month in year short "Oct" MMMM month in year long "October yy year short "05" yyyy year long "2005"

formatNumber

public String formatNumber(double number)

formatNumber

public String formatNumber(double number,
                           int decimals)

formatNumber

public String formatNumber(long number)

formatPercentage

public String formatPercentage(float number,
                               int decimals)

formatPercentage

public String formatPercentage(long value)

getLocale

public Locale getLocale()

PenProfile 2.x

Copyright © 2010 Livescribe Inc. All Rights Reserved.
Confidential and subject to NDA.