jimmc.util
Class StringUtil
java.lang.Object
|
+--jimmc.util.StringUtil
- public class StringUtil
- extends java.lang.Object
Utility methods for use with strings.
Method Summary |
static java.lang.String |
getInitials(java.lang.String name)
Given a string, return the initials, i.e. |
static java.lang.String |
getUpperCaseInitials(java.lang.String name)
Given a string, return the upper-case initials,
i.e. |
static java.lang.String[] |
toArray(java.lang.String s,
char sep)
Split up a string into an array of strings on a separator char. |
static java.lang.String[] |
toArray(java.lang.String s,
char sep,
boolean ignoreEmpty)
Split up a string into an array of strings. |
static java.lang.String |
toString(java.lang.Object[] aa,
char sep)
Given an array, convert it to a single string. |
static java.lang.String |
toString(java.lang.Object[] aa,
java.lang.String sep)
Given an array, convert it to a single string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StringUtil
public StringUtil()
toArray
public static java.lang.String[] toArray(java.lang.String s,
char sep)
- Split up a string into an array of strings on a separator char.
toArray
public static java.lang.String[] toArray(java.lang.String s,
char sep,
boolean ignoreEmpty)
- Split up a string into an array of strings.
- Parameters:
s
- The string to split.sep
- The separator character on which to split.ignoreEmpty
- If true, treat multiple separators as
a single separator, and ignore blank entries between
separators.- Returns:
- The separated strings.
toString
public static java.lang.String toString(java.lang.Object[] aa,
char sep)
- Given an array, convert it to a single string.
toString
public static java.lang.String toString(java.lang.Object[] aa,
java.lang.String sep)
- Given an array, convert it to a single string.
getInitials
public static java.lang.String getInitials(java.lang.String name)
- Given a string, return the initials, i.e. a string consisting
of the first non-blank character of the string plus the first
non-blank character after each blank.
getUpperCaseInitials
public static java.lang.String getUpperCaseInitials(java.lang.String name)
- Given a string, return the upper-case initials,
i.e. a string consisting of the first non-blank character of
each space-separated token in the string which is an upper-case
character.