Class LcText


  • public class LcText
    extends java.lang.Object
    LcText defines objects in support of XFA text picture patterns.

    Text picture patterns are used to parse and format text strings. Here are the metasymbols that form valid text picture patterns:

    9
    a single numeric character.
    A
    a single alphabetic character.
    O
    a single alphanumeric character.
    X
    a single character.
    Here's a snippet of code illustrating the use of LcText to reformat a text string
    
          import com.adobe.xfa.ut.LcNum; 
          ...
          LcText text = new LcText("Agent 007", "'Agent '999");
          if (text.isValid())
              String s = text.format("999' bottles of beer ...'");
          text = new LcText("Ben-Vindo a Cozumel.",
                               "'Ben-Vindo a 'AAAAAAA.", "es_MX");
          if (text.isValid())
              String s = text.format("'Playa ' XXXXXXX");
     
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String TEXT_PICTURE_SYMBOLS
      LcText pattern symbols: 9AO0X.
    • Constructor Summary

      Constructors 
      Constructor Description
      LcText​(java.lang.String text, java.lang.String locale)
      Instantiates an LcText object from the given text and in the locale given.
      LcText​(java.lang.String text, java.lang.String pat, java.lang.String locale)
      Instantiates an LcText object from the given text in the pattern given and in the locale given.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String format​(java.lang.String pat)
      Formats this object according to given text pattern string.
      static int getSymbolCount​(java.lang.String pic)
      Parse the text picture and return the number of symbols the picture implies.
      java.lang.String getText()
      Gets this object's parsed text.
      boolean isValid()
      Determines if this object is valid.
      boolean parse​(java.lang.String str, java.lang.String pat)
      Parses the given string according to the text pattern given.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • TEXT_PICTURE_SYMBOLS

        public static final java.lang.String TEXT_PICTURE_SYMBOLS
        LcText pattern symbols: 9AO0X.
        See Also:
        Constant Field Values
    • Constructor Detail

      • LcText

        public LcText​(java.lang.String text,
                      java.lang.String locale)
        Instantiates an LcText object from the given text and in the locale given.
        Parameters:
        text - a text string.
        locale - a locale name. When empty, it will default to the default locale.
      • LcText

        public LcText​(java.lang.String text,
                      java.lang.String pat,
                      java.lang.String locale)
        Instantiates an LcText object from the given text in the pattern given and in the locale given.
        Parameters:
        text - a text string.
        pat - a text pattern string used to parse the given text.
        locale - a locale name. When empty, it will default to the default locale.
    • Method Detail

      • format

        public java.lang.String format​(java.lang.String pat)
        Formats this object according to given text pattern string.
        Parameters:
        pat - a text pattern string.
        Returns:
        the text string formatted according to the given pattern string, upon success, and the empty string, upon error.
      • getSymbolCount

        public static int getSymbolCount​(java.lang.String pic)
        Parse the text picture and return the number of symbols the picture implies.
        Parameters:
        pic - - a picture pattern string.
      • getText

        public java.lang.String getText()
        Gets this object's parsed text.
        Returns:
        the text associated with this object.
      • isValid

        public boolean isValid()
        Determines if this object is valid.
        Returns:
        boolean true if valid, and false otherwise.
      • parse

        public boolean parse​(java.lang.String str,
                             java.lang.String pat)
        Parses the given string according to the text pattern given.
        Parameters:
        str - the text string to parse.
        pat - a text pattern string.
        Returns:
        boolean true if successfully parsed, and false otherwise.