Package org.eclipse.birt.core.format

# Class StringFormatter

java.lang.Object
org.eclipse.birt.core.format.StringFormatter

All Implemented Interfaces:
  `IFormatter`

public class StringFormatter extends Object implements IFormatter
Defines a string formatting class. Notice that unlike numeric or Date formatting, locale is irrelevant in string formatting

## Nested Class Summary

## Nested classes/interfaces inherited from interface org.eclipse.birt.core.format.IFormatter

`IFormatter.DefaultFormatter`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected String`
`formatPattern`
`protected static Logger`
`logger`
logger used to log syntax errors.

## Constructor Summary

Constructors
Constructor
Description
`StringFormatter()`
constructor with no argument
`StringFormatter(com.ibm.icu.util.ULocale locale)`
constructor with no formatting string
`StringFormatter(String format)`
constructor with a format string argument
`StringFormatter(String format, com.ibm.icu.util.ULocale locale)`
Constructor with the format string and locale
`StringFormatter(String format, Locale locale)`
Deprecated.
since 2.1
`StringFormatter(Locale locale)`
Deprecated.
since 2.1

## Method Summary

Modifier and Type
Method
Description
`void`
`applyPattern(String format)`
`String`
`format(String str)`
returns the formated string for the string parameter.
`String`
`formatValue(Object value)`
format the value object into a string.
`Locale`
`getLocale()`
Deprecated.
since 2.1
`String`
`getPattern()`
returns the original format string.
`com.ibm.icu.util.ULocale`
`getULocale()`
getLoacle() method, return the locale value.
`String`
`parser(String str)`
Parses the input string into a unformatted string type.
`void`
`setLocale(com.ibm.icu.util.ULocale theLocale)`
setLoacle() method, set the locale value.
`void`
`setLocale(Locale theLocale)`
Deprecated.
since 2.1
`void`
`setTrim(boolean trim)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### logger

protected static Logger logger
logger used to log syntax errors.

### formatPattern

protected String formatPattern

## Constructor Details

### StringFormatter

public StringFormatter()
constructor with no argument

### StringFormatter

public StringFormatter(com.ibm.icu.util.ULocale locale)
constructor with no formatting string

### StringFormatter

@Deprecated public StringFormatter(Locale locale)
Deprecated.
since 2.1

### StringFormatter

public StringFormatter(String format)
constructor with a format string argument

Parameters:
  `format` - the format string

### StringFormatter

public StringFormatter(String format, com.ibm.icu.util.ULocale locale)
Constructor with the format string and locale

Parameters:
  `format` - the format string
  `locale` - the locale

### StringFormatter

@Deprecated public StringFormatter(String format, Locale locale)
Deprecated.
since 2.1

## Method Details

### applyPattern

public void applyPattern(String format)

Parameters:
  `format` - the format pattern

### getPattern

public String getPattern()
returns the original format string.

### getULocale

public com.ibm.icu.util.ULocale getULocale()
getLoacle() method, return the locale value.

### getLocale

@Deprecated public Locale getLocale()
Deprecated.
since 2.1

Returns:

### setLocale

public void setLocale(com.ibm.icu.util.ULocale theLocale)
setLoacle() method, set the locale value.

### setLocale

@Deprecated public void setLocale(Locale theLocale)
Deprecated.
since 2.1

### format

public String format(String str)
returns the formated string for the string parameter.
'@' - character or space
'invalid input: '&'' - character or empty
'<' - tolower
'>' - toupper
'!' - left to right

Parameters:
  `str` - format string

- ### parser

  public String parser(String str) throws ParseException
  Parses the input string into a unformatted string type.
  Parameters:
    `str` - the input string to parse
  Returns:
    the string
  Throws:
    `ParseException` - if the specified string cannot be parsed according to specified pattern.

- ### setTrim

  public void setTrim(boolean trim)
  Parameters:
    `trim` - the trim to set

- ### formatValue

  public String formatValue(Object value)
  Description copied from interface: `IFormatter`
  format the value object into a string.
  Specified by:
    `formatValue` in interface `IFormatter`
  Parameters:
    `value` -
  Returns: