|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.abstractics.utils.StringUtils
Various static methods to perform simple String manipulations
Method Summary | |
static java.lang.String |
classNameOnly(java.lang.Class clazz)
|
static java.lang.String |
ensureString(java.lang.String string)
Given a String object, will return the String object itself, or if it is null, then and empty String is returned. |
static java.lang.String |
ensureString(java.lang.String string,
java.lang.String defaultValue)
Given a String object, will return the String object itself, or if it is null, then the specified defaultValue is returned. |
static java.lang.String |
fill(char ch,
int size)
Given a character and the number of those characters to use, returns a String composed of that many of the character. i.e. |
static boolean |
isEmpty(java.lang.String str)
|
static java.lang.String |
maxLength(java.lang.String str,
int length)
Returns the string making sure that it does not exceed the given max length, and if it does, it is truncated to that length. |
static java.lang.String |
padLeft(java.lang.String str,
int totalLength)
Given a string and a total length that it should be, this method appends spaces repeatedly onto the left of the string to make the string the correct length, or truncates the string |
static java.lang.String |
padLeft(java.lang.String str,
int totalLength,
char padChar)
Given a string and a total length that it should be, this method appends the given character repeatedly onto the left of the string to make the string the correct length, or truncates the string |
static java.lang.String |
padRight(java.lang.String str,
int totalLength)
Given a string and a total length that it should be, this method appends spaces repeatedly onto the right of the string to make the string the correct length, or truncates the string |
static java.lang.String |
padRight(java.lang.String str,
int totalLength,
char padChar)
Given a string and a total length that it should be, this method appends the given character repeatedly onto the right of the string to make the string the correct length, or truncates the string |
static java.lang.String |
stripChars(java.lang.String s,
char[] stripChars)
|
static java.lang.String |
stripNewlines(java.lang.String str)
Given a String, any newlines will be removed and replaced with a space |
static java.lang.String |
toUpperCase(java.lang.String str)
|
static java.lang.String |
trimString(java.lang.String string)
Returns a trimmed string, and if the trimming results in a zero length String, returns null; |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static java.lang.String classNameOnly(java.lang.Class clazz)
clazz
- Class to get class name for
public static java.lang.String padRight(java.lang.String str, int totalLength)
str
- Original StringtotalLength
- Final length that the String should be
public static java.lang.String padRight(java.lang.String str, int totalLength, char padChar)
str
- Original StringtotalLength
- Final length that the String should bepadChar
- The character to use for padding
public static java.lang.String padLeft(java.lang.String str, int totalLength)
str
- Original StringtotalLength
- Final length that the String should be
public static java.lang.String padLeft(java.lang.String str, int totalLength, char padChar)
str
- Original StringtotalLength
- Final length that the String should bepadChar
- The character to use for padding
public static boolean isEmpty(java.lang.String str)
str
-
public static java.lang.String toUpperCase(java.lang.String str)
str
-
public static java.lang.String fill(char ch, int size)
ch
- size
-
public static java.lang.String trimString(java.lang.String string)
string
-
public static java.lang.String ensureString(java.lang.String string)
string
- String to check
public static java.lang.String ensureString(java.lang.String string, java.lang.String defaultValue)
defaultValue
is returned.
string
- String to checkdefaultValue
- The default String to return if string is null
public static java.lang.String stripChars(java.lang.String s, char[] stripChars)
public static java.lang.String maxLength(java.lang.String str, int length)
str
- String to check
public static java.lang.String stripNewlines(java.lang.String str)
str
-
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |