Class LcText


  • public class LcText
    extends 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 Detail

    • Constructor Detail

      • LcText

        public LcText​(String text,
                      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​(String text,
                      String pat,
                      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 String format​(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​(String pic)
        Parse the text picture and return the number of symbols the picture implies.
        Parameters:
        pic - - a picture pattern string.
      • getText

        public 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​(String str,
                             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.