Class StringFormatter

  • All Implemented Interfaces:
    IFormatter

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

      Fields 
      Modifier and Type Field Description
      protected java.lang.String formatPattern  
      protected static java.util.logging.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​(java.lang.String format)
      constructor with a format string argument
      StringFormatter​(java.lang.String format, com.ibm.icu.util.ULocale locale)
      Constructor with the format string and locale
      StringFormatter​(java.lang.String format, java.util.Locale locale)
      Deprecated.
      since 2.1
      StringFormatter​(java.util.Locale locale)
      Deprecated.
      since 2.1
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void applyPattern​(java.lang.String format)  
      java.lang.String format​(java.lang.String str)
      returns the formated string for the string parameter.
      java.lang.String formatValue​(java.lang.Object value)
      format the value object into a string.
      java.util.Locale getLocale()
      Deprecated.
      since 2.1
      java.lang.String getPattern()
      returns the original format string.
      com.ibm.icu.util.ULocale getULocale()
      getLoacle() method, return the locale value.
      java.lang.String parser​(java.lang.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​(java.util.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 Detail

      • logger

        protected static java.util.logging.Logger logger
        logger used to log syntax errors.
      • formatPattern

        protected java.lang.String formatPattern
    • Constructor Detail

      • 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​(java.util.Locale locale)
        Deprecated.
        since 2.1
      • StringFormatter

        public StringFormatter​(java.lang.String format)
        constructor with a format string argument
        Parameters:
        format - the format string
      • StringFormatter

        public StringFormatter​(java.lang.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​(java.lang.String format,
                               java.util.Locale locale)
        Deprecated.
        since 2.1
    • Method Detail

      • applyPattern

        public void applyPattern​(java.lang.String format)
        Parameters:
        format - the format pattern
      • getPattern

        public java.lang.String getPattern()
        returns the original format string.
      • getULocale

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

        @Deprecated
        public java.util.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​(java.util.Locale theLocale)
        Deprecated.
        since 2.1
      • format

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