Package helma.util
Class StringUtils
- java.lang.Object
-
- helma.util.StringUtils
-
public class StringUtils extends java.lang.Object
Utility class for String manipulation.
-
-
Constructor Summary
Constructors Constructor Description StringUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String[]
collect(java.util.Enumeration en)
Collect items of a string enumeration into a String array.static java.lang.String
getCommonPrefix(java.lang.String s1, java.lang.String s2)
Get the largest common prefix of Strings s1 and s2static java.lang.String[]
split(java.lang.String str)
Split a string into an array of strings.static java.lang.String[]
split(java.lang.String str, java.lang.String delim)
Split a string into an array of strings.static java.lang.String[]
splitLines(java.lang.String str)
Split a string into an array of lines.static char[]
toCharArray(java.lang.String str)
Get the character array for a string.
-
-
-
Method Detail
-
split
public static java.lang.String[] split(java.lang.String str)
Split a string into an array of strings. Use comma and space as delimiters.
-
split
public static java.lang.String[] split(java.lang.String str, java.lang.String delim)
Split a string into an array of strings.
-
splitLines
public static java.lang.String[] splitLines(java.lang.String str)
Split a string into an array of lines.- Parameters:
str
- the string to split- Returns:
- an array of lines
-
toCharArray
public static char[] toCharArray(java.lang.String str)
Get the character array for a string. Useful for use from Rhino, where the Java String methods are not readily available without constructing a new String instance.- Parameters:
str
- a string- Returns:
- the char array
-
collect
public static java.lang.String[] collect(java.util.Enumeration en)
Collect items of a string enumeration into a String array.- Parameters:
en
- an enumeration of strings- Returns:
- the enumeration values as string array
-
getCommonPrefix
public static java.lang.String getCommonPrefix(java.lang.String s1, java.lang.String s2)
Get the largest common prefix of Strings s1 and s2- Parameters:
s1
- a strings2
- another string- Returns:
- the largest prefix shared by both strings
-
-