Package com.adobe.xfa.ut
Class LcText
java.lang.Object
com.adobe.xfa.ut.LcText
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.
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionFormats this object according to given text pattern string.static intgetSymbolCount(String pic) Parse the text picture and return the number of symbols the picture implies.getText()Gets this object's parsed text.booleanisValid()Determines if this object is valid.booleanParses the given string according to the text pattern given.
-
Field Details
-
TEXT_PICTURE_SYMBOLS
LcText pattern symbols: 9AO0X.- See Also:
-
-
Constructor Details
-
LcText
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
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 Details
-
format
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
Parse the text picture and return the number of symbols the picture implies.- Parameters:
pic- - a picture pattern 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
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.
-