public class StringUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
capitalize(String text)
Capitlize each word in a string (journal titles, etc)
|
static boolean |
isNull(String string)
Null (or zero-length) String?
|
static void |
main(String[] args) |
static String |
removeCharacterOrRangeAsCharacter(String source,
String pattern)
Remove a character (or range of characters) from a string.
|
static String |
removeCharacterOrRangeAsWord(String source,
String pattern)
Remove a character (or range of characters) from a string.
|
static String |
replace(String text,
String targetText,
String newText)
Replace all occurances of the target text with the provided replacement
text.
|
static String |
trimAll(String text,
char character)
Trim specified charcater from both ends of a String
|
static String |
trimEnd(String text,
char character)
Trim specified charcater from end of string
|
static String |
trimFront(String text,
char character)
Trim specified charcater from front of string
|
static String |
truncateAtWhitespace(String text,
int length)
Truncate text on a whitespace boundary (near a specified length).
|
public static String replace(String text, String targetText, String newText)
java.util.regex.Matcher.text - Text to modifytargetText - Text to find and replacenewText - New textpublic static boolean isNull(String string)
public static String truncateAtWhitespace(String text, int length)
(requested-length * .25) ~ (requested-length * 1.5) text - Text to truncatelength - Target lengthpublic static String trimFront(String text, char character)
text - Textcharacter - Character to removepublic static String trimEnd(String text, char character)
text - Textcharacter - Character to removepublic static String trimAll(String text, char character)
text - Textcharacter - Character to removepublic static String capitalize(String text)
text - Text to inspectpublic static String removeCharacterOrRangeAsWord(String source, String pattern)
source - String to editpattern - Character (or range) to remove. Range is a regular
expression: [,-/] or [,-/]public static String removeCharacterOrRangeAsCharacter(String source, String pattern)
source - String to editpattern - Character (or range) to remove. Range is a regular
expression: [,-/] or [,-/]Copyright © 2003–2020 Sakai Project. All rights reserved.