org.mmbase.util
Class StringSplitter

java.lang.Object
  extended by org.mmbase.util.StringSplitter

public class StringSplitter
extends Object

Utility class for splitting delimited values.

Version:
$Id: StringSplitter.java 41036 2010-02-15 22:30:54Z michiel $
Author:
Pierre van Rooden, Kees Jongenburger, Michiel Meeuwissen

Method Summary
static Map<String,String> map(String string)
           
static Map<String,String> map(String string, String delimiter)
          Splits a String into a map.
static List<String> split(String string)
          Simple util method to split comma separated values.
static List<String> split(String string, String delimiter)
          Simple util method to split delimited values to a list.
static List<String> splitFunctions(CharSequence attribute)
          Splits up a String, (using comma delimiter), but takes into account brackets.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

split

public static List<String> split(String string,
                                 String delimiter)
Simple util method to split delimited values to a list. Useful for attributes. Similar to String.split(), but returns a List instead of an array, and trims the values.

Parameters:
string - the string to split
delimiter -
Returns:
a (modifiable) List containing the elements

split

public static List<String> split(String string)
Simple util method to split comma separated values.

Parameters:
string - the string to split
Returns:
a List containing the elements
See Also:
split(String, String)

splitFunctions

public static List<String> splitFunctions(CharSequence attribute)
Splits up a String, (using comma delimiter), but takes into account brackets. So a(b,c,d),e,f(g) will be split up in a(b,c,d) and e and f(g).

Since:
MMBase-1.8

map

public static Map<String,String> map(String string)
Since:
MMBase-1.9

map

public static Map<String,String> map(String string,
                                     String delimiter)
Splits a String into a map.

Parameters:
delimiter - Delimiter to split entries. If this is a newline, then the string will be read like properties
Since:
MMBase-1.9.1


MMBase 2.0-SNAPSHOT - null