All Packages Class Hierarchy This Package Previous Next Index
Class tea.set.Mask
java.lang.Object
|
+----tea.set.Mask
- public class Mask
- extends Object
Mask supports text mask verification and related functions.
It supports the following wildcard characters.
- \
- character, remove the special meaning of [ and ]
- c
- alphabet, lower case
- C
- alphabet, upper case
- A
- alphabet (c || C) and space
- ,
- (, . ' " ; : / ? !)
- 9
- * V - digits or decimal points
- S
- digit, space, and punctuation
- X
- character
Each mask can contain one or many pictures enclosed in bracket:
ex. "Name: [CAAAAAAAAAAAA] Tel: [999]-[999]-[9999]"
- See Also:
- MaskText
-
Mask(String)
- Create a Mask from a mask specification string.
-
getMask()
- Return the mask specification.
-
isPunct(char)
- Check if a character is a punctuation.
-
length(String)
- Char length of a mask without the extra mask specification characters.
-
nextPos(int, boolean)
- Find the next picture position if the current position is not
in a picture area.
-
toString()
- Convert the mask to a string with editable position converted to
space.
-
toString(char)
- Return a string where space character is substituted by space
parameter value.
-
verify(String)
- Verify a text string against the mask.
Mask
public Mask(String ms)
- Create a Mask from a mask specification string.
- Parameters:
- ms - mask specification.
length
public static int length(String s)
- Char length of a mask without the extra mask specification characters.
- Returns:
- character length of mask string.
verify
public boolean verify(String s) throws Exception
- Verify a text string against the mask.
- Parameters:
- s - string value to verify.
- Returns:
- true if verification passed.
- Throws: Exception
- if the verification fails.
nextPos
public int nextPos(int pos,
boolean forward)
- Find the next picture position if the current position is not
in a picture area.
- Parameters:
- pos - current character position.
- forward - true to search forward, otherwise search backward.
- Returns:
- next editable position.
isPunct
public static boolean isPunct(char c)
- Check if a character is a punctuation.
- Parameters:
- c - character value to check.
- Returns:
- true if c is punctuation.
toString
public String toString()
- Convert the mask to a string with editable position converted to
space.
- Overrides:
- toString in class Object
toString
public String toString(char space)
- Return a string where space character is substituted by space
parameter value.
- Parameters:
- space - character for space.
- Returns:
- string value of mask.
getMask
public String getMask()
- Return the mask specification.
- Returns:
- mask specification.
All Packages Class Hierarchy This Package Previous Next Index