jsky.util
Class StringUtil

java.lang.Object
  extended by jsky.util.StringUtil

public class StringUtil
extends Object

Contains static String utility methods.


Constructor Summary
StringUtil()
           
 
Method Summary
static boolean equals(String s1, String s2)
          Return true if the two strings are equal (like String.equals(), but allowing null values for both operands).
static void main(String[] args)
          test main
static boolean match(String pattern, String string)
          Checks whether a string matches a given wildcard pattern.
static String replace(String source, String target, String replacement)
          Replace all occurances of the given target string with the given replacement string in the source string.
static String[] split(String s, int sep)
          Split the string s at the given separator char, if found, and return an array containing the two resulting strings, or null if the separator char was not found.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringUtil

public StringUtil()
Method Detail

replace

public static String replace(String source,
                             String target,
                             String replacement)
Replace all occurances of the given target string with the given replacement string in the source string.

Parameters:
source - source string to be searched
target - the target string to replace
replacement - the value to replace the target string with
Returns:
a new string with the target string replaced with the replacement string.

split

public static String[] split(String s,
                             int sep)
Split the string s at the given separator char, if found, and return an array containing the two resulting strings, or null if the separator char was not found.


equals

public static boolean equals(String s1,
                             String s2)
Return true if the two strings are equal (like String.equals(), but allowing null values for both operands).


match

public static boolean match(String pattern,
                            String string)
Checks whether a string matches a given wildcard pattern. Only does ? and * (or '%'), and multiple patterns separated by |. (Taken from http://www.acme.com/java/software/Acme.Utils.html).


main

public static void main(String[] args)
test main



Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.