|
|||||||||
| Home >> All >> com >> eireneh >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.eireneh.util
Class Validator

java.lang.Objectcom.eireneh.util.Validator
- public final class Validator
- extends java.lang.Object
A generic class of String utils. It would be good if we could put this stuff in java.lang ...
|
Distribution Licence: Project B is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. The License is available on the internet here, by writing to Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, Or locally at the Licence link below. The copyright to this program is held by it's authors. |
| Constructor Summary | |
private |
Validator()
Ensure that we can not be instansiated |
| Method Summary | |
static boolean |
isAsciiAlphanumeric(java.lang.String test)
Check that the given string contains ascii letters (upper and lower) and numbers only. |
static boolean |
isInternetEmail(java.lang.String text)
Check that the given text represents a potentially valid email address. |
static boolean |
isSafeEmbededHTML(java.lang.String test)
Check that the given string does not contain control characters (except return, ff or tab) or any triangular brackets or ampersands. |
static boolean |
isSimpleAscii(java.lang.String test)
Check that the given string contains letters (upper and lower), and simple punctuation only. |
static boolean |
isSpaceAlphanumeric(java.lang.String test)
Check that the given string contains letters (upper and lower), space and numbers only. |
static java.lang.String |
trimToNumberic(java.lang.String orig)
Take a string (for example "£2,000.00") and chop out any of the chars that make it fail to parse (giving 2000.00) All we do is chop out any chars that are not one of "+", "-", "." or a number |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
Validator
private Validator()
- Ensure that we can not be instansiated
| Method Detail |
isAsciiAlphanumeric
public static boolean isAsciiAlphanumeric(java.lang.String test)
- Check that the given string contains ascii letters (upper and lower) and
numbers only. This is useful for checking identifiers for special values
isSpaceAlphanumeric
public static boolean isSpaceAlphanumeric(java.lang.String test)
- Check that the given string contains letters (upper and lower), space
and numbers only. In effect there can be no control characters or
punctuation. This ensures that the string can be safely displayed in a
web browser without side effects.
isSimpleAscii
public static boolean isSimpleAscii(java.lang.String test)
- Check that the given string contains letters (upper and lower), and
simple punctuation only. In effect there can be no control characters
or dangerous punctuation. This ensures that the string can be safely
displayed in a web browser without side effects. The allowed
punctuation marks are [comma], [apostrophe], [period], [minus],
[query], [bang], [quote], [slash], [open paren], [close paren] and
[colon]
isSafeEmbededHTML
public static boolean isSafeEmbededHTML(java.lang.String test)
- Check that the given string does not contain control characters (except
return, ff or tab) or any triangular brackets or ampersands.
i.e. nothing that HTML regards as special.
isInternetEmail
public static boolean isInternetEmail(java.lang.String text)
- Check that the given text represents a potentially valid email
address. We should reject all of the following: a, a@b, a@b.c.
There is probably a lot more we could do to become an rfc822 strict
tester, probably mostly in the character set arena. I've seen a regex
to do this better, but is is very unmaintainable and it requires a
regex library.
trimToNumberic
public static java.lang.String trimToNumberic(java.lang.String orig)
- Take a string (for example "£2,000.00") and chop out any of the
chars that make it fail to parse (giving 2000.00) All we do is
chop out any chars that are not one of "+", "-", "." or a number
|
|||||||||
| Home >> All >> com >> eireneh >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.eireneh.util.Validator