|
|||||||||
| Home >> All >> nectar >> [ services overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
nectar.services
Class StringTools

java.lang.Objectnectar.services.StringTools
- public abstract class StringTools
- extends java.lang.Object
A collection of String transformation utilities.
| Field Summary | |
private static byte |
INVALID
|
private static byte |
NO_TAG
|
private static byte |
TAG_ATTR
|
private static byte |
TAG_NAME
|
| Constructor Summary | |
StringTools()
|
|
| Method Summary | |
static java.lang.String |
boolToString(boolean b)
if the given boolean is true, returns the String "true", else return "false". |
static java.lang.String |
nl2br(java.lang.String original)
Converts all newline characters in the given String to " ". |
static boolean |
stringToBool(java.lang.String s)
if the given String is "true" or "yes", return true. |
static java.lang.String |
strip_tags(java.lang.String original,
java.util.Collection allowed_tags)
Parse a string and remove all HTML tags and the like (php, xml, javascript, etc) except the allowed_tags. |
static java.lang.String |
word_trim(java.lang.String original,
int maxLength)
Shortens a String to a certain character length without chopping words. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
NO_TAG
private static final byte NO_TAG
- See Also:
- Constant Field Values
TAG_NAME
private static final byte TAG_NAME
- See Also:
- Constant Field Values
TAG_ATTR
private static final byte TAG_ATTR
- See Also:
- Constant Field Values
INVALID
private static final byte INVALID
- See Also:
- Constant Field Values
| Constructor Detail |
StringTools
public StringTools()
| Method Detail |
word_trim
public static java.lang.String word_trim(java.lang.String original, int maxLength)
- Shortens a String to a certain character length without chopping words. If the given String is longer than maxLength, The returned String will contain the beginning of the given String and "..." after the last word before the given character length is reached. The resulting String is never long than maxLength. If no words are cut (because the String is shorter than maxLength, the String is returned as is.
nl2br
public static java.lang.String nl2br(java.lang.String original)
- Converts all newline characters in the given String to "
".
boolToString
public static java.lang.String boolToString(boolean b)
- if the given boolean is true, returns the String "true", else return "false".
stringToBool
public static boolean stringToBool(java.lang.String s)
- if the given String is "true" or "yes", return true. If the String is anything else, return false.
strip_tags
public static java.lang.String strip_tags(java.lang.String original, java.util.Collection allowed_tags)
- Parse a string and remove all HTML tags and the like (php, xml, javascript, etc)
except the allowed_tags.
Some of the code in this class was copied and translated to Java from the PHP 3.0.18 distribution, in accordance to the GNU Public License.
Note that if you allow the "a" tag, all it's descendants (a href, a name, a onMouseOver, etc) will also be allowed.
|
|||||||||
| Home >> All >> nectar >> [ services overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
nectar.services.StringTools