irssibot.util
Class StringUtil

java.lang.Object
  |
  +--irssibot.util.StringUtil

public final class StringUtil
extends java.lang.Object

Includes a collection of handy tools for parsing and editing strings.

Version:
$Name: $ $Revision: 1.5 $
Author:
Matti Dahlbom

Constructor Summary
StringUtil()
           
 
Method Summary
static java.lang.String join(java.lang.String[] input)
          combines all elements of a stringtable into a single string.
static java.lang.String join(java.lang.String[] input, int beginIndex)
          combines elements of a stringtable into a single string.
static java.lang.String join(java.lang.String[] input, int beginIndex, int endIndex)
          combines elements of a stringtable into a single string.
static java.lang.String[] lines(java.lang.String input)
          take a multiline string as input and separate each line and return a table of the separated lines.
static java.lang.String[] range(java.lang.String[] input, int beginIndex)
          Returns a range of a string table elements as a new string table starting from beginIndex to end of the input table.
static java.lang.String[] range(java.lang.String[] input, int beginIndex, int endIndex)
          Returns a range of a string table elements as a new string table
static java.lang.String replace(java.lang.String s, java.lang.String sub, java.lang.String replacement)
          Replaces strings of characters in a String with anothers.
static java.lang.String[] separate(java.lang.String input, char sepChar)
          break up a String by separating it by sepChar's.
static java.lang.String verify(java.lang.String input)
          Verify string.
static boolean wildmatch(java.lang.String mask, java.lang.String input)
          Do wildcard matching for two strings.
 
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 java.lang.String replace(java.lang.String s,
                                       java.lang.String sub,
                                       java.lang.String replacement)
Replaces strings of characters in a String with anothers.

Parameters:
s - string whose substrings to replace
sub - substring to be replaced
replacement - new substring to replace
Returns:
new string with given substrings replaced

range

public static java.lang.String[] range(java.lang.String[] input,
                                       int beginIndex,
                                       int endIndex)
Returns a range of a string table elements as a new string table

Parameters:
input - string table
beginIndex - first element of the range
endIndex - last element of the range
Returns:
range

range

public static java.lang.String[] range(java.lang.String[] input,
                                       int beginIndex)
Returns a range of a string table elements as a new string table starting from beginIndex to end of the input table.

Parameters:
input - string table
beginIndex - first element of the range
Returns:
range

join

public static java.lang.String join(java.lang.String[] input,
                                    int beginIndex,
                                    int endIndex)
combines elements of a stringtable into a single string.

Parameters:
input - string table
beginIndex - first element of the range
endIndex - last element of the range
Returns:
combined string

join

public static java.lang.String join(java.lang.String[] input,
                                    int beginIndex)
combines elements of a stringtable into a single string. range to combine is from firstIndex to end of the table.

Parameters:
input - string table
beginIndex - first element of the range
Returns:
combined string

join

public static java.lang.String join(java.lang.String[] input)
combines all elements of a stringtable into a single string.

Parameters:
input - string table
Returns:
combined string

separate

public static java.lang.String[] separate(java.lang.String input,
                                          char sepChar)
break up a String by separating it by sepChar's. return the sections as a string table.

Parameters:
input - input string
sepChar - separating character
Returns:
separated strings as a table

verify

public static java.lang.String verify(java.lang.String input)
Verify string. the following things are done:

Parameters:
input - input string
Returns:
verified string or null if failed

lines

public static java.lang.String[] lines(java.lang.String input)
take a multiline string as input and separate each line and return a table of the separated lines.

Parameters:
input - source (multiline) string
Returns:
separated lines as table

wildmatch

public static boolean wildmatch(java.lang.String mask,
                                java.lang.String input)
Do wildcard matching for two strings. Comparison is not case sensitive.

Parameters:
mask - pattern to match
input - string
Returns:
  • true if match
  • false if not


IrssiBot (c) 2000-2002 Matti Dahlbom