Package gw.internal.gosu.util
Class StringUtil
- java.lang.Object
-
- gw.internal.gosu.util.StringUtil
-
public class StringUtil extends Object
-
-
Constructor Summary
Constructors Constructor Description StringUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringBuffer
join(String glue, String[] strings)
Takes a string 'glue' and array of strings, and returns a StringBuffer containing the strings joined with the glue between each of them.static StringBuffer
join(String glue, String[] strings, int first, int last)
Takes a string 'glue' and array of strings, and returns a StringBuffer containing the strings between the specified indices (inclusive) joined with the glue between each of them.static <E> StringBuffer
join(String glue, Collection<E> charSequences)
Takes a string 'glue' and collection of CharSequences, and returns a StringBuffer containing the CharSequences joined with the glue between each of them.static List<String>
tokenizeToList(String s, char separator)
Split up a string into tokens delimited by the specified separator character.
-
-
-
Method Detail
-
tokenizeToList
public static List<String> tokenizeToList(String s, char separator)
Split up a string into tokens delimited by the specified separator character. If the string is null or zero length, returns null.- Parameters:
s
- The String to tokenizeseparator
- The character delimiting tokens- Returns:
- A List of String tokens, or null is s is null or 0 length.
-
join
public static StringBuffer join(String glue, String[] strings)
Takes a string 'glue' and array of strings, and returns a StringBuffer containing the strings joined with the glue between each of them. The strings are joined in order *- Parameters:
glue
- The glue stringstrings
- The strings to join- Returns:
- a StringBuffer
-
join
public static StringBuffer join(String glue, String[] strings, int first, int last)
Takes a string 'glue' and array of strings, and returns a StringBuffer containing the strings between the specified indices (inclusive) joined with the glue between each of them. The strings are joined in order- Parameters:
glue
- The glue stringstrings
- The strings to joinfirst
- The index of the first string to joinlast
- The index of the last string to join- Returns:
- a StringBuffer
-
join
public static <E> StringBuffer join(String glue, Collection<E> charSequences)
Takes a string 'glue' and collection of CharSequences, and returns a StringBuffer containing the CharSequences joined with the glue between each of them. They are joined in the order returned by the iterator of the colection- Parameters:
glue
- The glue stringcharSequences
- The CharSequences to join- Returns:
- a StringBuffer
-
-