Provides a mask that a value entry should conform to
A mask to apply to string attributes.
The characters that can be used are shown in the following table (adapted from masks used by Swing's
MaskFormatter, Java's SimpleDateFormat and also Microsoft's MaskedEdit control):
| Character |
Description |
Source |
| # |
Digit placeholder. |
MS, Swing |
| . |
Decimal placeholder. The actual character used is the one specified as the decimal
placeholder in your international settings. This character is treated as a literal for masking purposes. |
MS |
| , |
Thousands separator. The actual character used is the one specified as the thousands
separator in your international settings. This character is treated as a literal for masking purposes. |
MS |
| : |
Time separator. This character is treated as a literal for masking purposes. |
MS |
| / |
Date separator. This character is treated as a literal for masking purposes. |
MS |
| & |
Character placeholder. Valid values for this placeholder are ANSI characters in the
following ranges: 32-126 and 128-255. |
MS |
| A |
Alphanumeric character placeholder (Character.isLetter or
Character.isDigit), with entry required. For example: a ~ z, A ~ Z, or 0 ~ 9. |
MS |
| a |
Alphanumeric character placeholder (entry optional). |
MS |
| 9 |
Digit placeholder (entry optional). For example: 0 ~ 9. |
MS |
| ? |
Letter placeholder (Character.isLetter). For example: a ~ z or A ~ Z. |
MS, Swing |
| U |
Any character (Character.isLetter). All lowercase letters are mapped to
upper case. |
Swing |
| L |
Any character (Character.isLetter). All lowercase letters are mapped to
lower case. |
Swing |
| Literal |
All other symbols are displayed as literals; that is, as themselves. |
MS |
| Character |
Description |
Source |
| \ or ' |
Treat the next character in the mask string as a literal. This allows you to include the
'#', '&', 'A', and '?' characters in the mask. This character is treated as a literal for masking purposes. |
MS (\), Swing (') |
| H |
Character.isLetter or Character.isDigit. |
Swing |
| yy or yyyy |
Year, eg 1996; 96. |
DateFormat |
| MM |
Two digit representation of month, eg 07 for July. |
DateFormat |
| MMM |
Three character representation of month, eg Jul for July. |
DateFormat |
| d |
Day in month, eg 3 or 28. |
DateFormat |
| dd |
Two digit representation of day in month, eg 03 or 28. |
DateFormat |
| HH |
Two digit representation of hour in day (24 hour clock), eg 05 or 19. |
DateFormat |
| mm |
Minute in hour, eg 02 or 47. |
DateFormat |
| ss |
Second in minute in hour, eg 08 or 35. |
DateFormat |