Package com.adobe.xfa.ut
Class LcText
- java.lang.Object
-
- com.adobe.xfa.ut.LcText
-
public class LcText extends java.lang.ObjectLcText 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.
LcTextto reformat a text stringimport 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.StringTEXT_PICTURE_SYMBOLSLcText 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.Stringformat(java.lang.String pat)Formats this object according to given text pattern string.static intgetSymbolCount(java.lang.String pic)Parse the text picture and return the number of symbols the picture implies.java.lang.StringgetText()Gets this object's parsed text.booleanisValid()Determines if this object is valid.booleanparse(java.lang.String str, java.lang.String pat)Parses the given string according to the text pattern given.
-
-
-
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.
-
-