Package helma.util

Class StringUtils

java.lang.Object
helma.util.StringUtils

public class StringUtils extends Object
Utility class for String manipulation.
  • Constructor Details

    • StringUtils

      public StringUtils()
  • Method Details

    • split

      public static String[] split(String str)
      Split a string into an array of strings. Use comma and space as delimiters.
    • split

      public static String[] split(String str, String delim)
      Split a string into an array of strings.
    • splitLines

      public static String[] splitLines(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(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 String[] collect(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 String getCommonPrefix(String s1, String s2)
      Get the largest common prefix of Strings s1 and s2
      Parameters:
      s1 - a string
      s2 - another string
      Returns:
      the largest prefix shared by both strings