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

Constructor Index

 o Mask(String)
Create a Mask from a mask specification string.

Method Index

 o getMask()
Return the mask specification.
 o isPunct(char)
Check if a character is a punctuation.
 o length(String)
Char length of a mask without the extra mask specification characters.
 o nextPos(int, boolean)
Find the next picture position if the current position is not in a picture area.
 o toString()
Convert the mask to a string with editable position converted to space.
 o toString(char)
Return a string where space character is substituted by space parameter value.
 o verify(String)
Verify a text string against the mask.

Constructors

 o Mask
 public Mask(String ms)
Create a Mask from a mask specification string.

Parameters:
ms - mask specification.

Methods

 o length
 public static int length(String s)
Char length of a mask without the extra mask specification characters.

Returns:
character length of mask string.
 o 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.
 o 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.
 o 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.
 o toString
 public String toString()
Convert the mask to a string with editable position converted to space.

Overrides:
toString in class Object
 o 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.
 o getMask
 public String getMask()
Return the mask specification.

Returns:
mask specification.

All Packages  Class Hierarchy  This Package  Previous  Next  Index