uk.org.iscream.cms.util
Class StringUtils

java.lang.Object
  extended byuk.org.iscream.cms.util.StringUtils

public class StringUtils
extends Object

A class containing useful methods for manipulating String objects.

Version:
$Id: StringUtils.java,v 1.9 2003/02/05 14:27:59 tdb Exp $
Author:
$Author: tdb $

Field Summary
private  String _name
          This is the friendly identifier of the component this class is running in.
static String REVISION
          The current CVS revision of this class
 
Constructor Summary
StringUtils()
           
 
Method Summary
static int getStringPos(String search, String[] array)
          This method takes an array of String's and a String to look for and returns the position in the array that the string occurs.
static String replaceText(String text, String search, String replace)
          Searches a string and replaces all occurences of the given search text with the given replacement text.
 String toString()
          Overrides the Object.toString() method to provide clean logging (every class should have this).
static boolean wildcardMatch(String in, String expression)
          Checks if a given string matches a wildcard expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
The current CVS revision of this class

See Also:
Constant Field Values

_name

private String _name
This is the friendly identifier of the component this class is running in. eg, a Filter may be called "filter1", If this class does not have an owning component, a name from the configuration can be placed here. This name could also be changed to null for utility classes.

Constructor Detail

StringUtils

public StringUtils()
Method Detail

replaceText

public static String replaceText(String text,
                                 String search,
                                 String replace)
Searches a string and replaces all occurences of the given search text with the given replacement text.

Parameters:
text - the text to search and replace in
search - the string to look for and replace
replace - the text to replace with
Returns:
the updated version of text

getStringPos

public static int getStringPos(String search,
                               String[] array)
This method takes an array of String's and a String to look for and returns the position in the array that the string occurs.

Parameters:
search - the string to look for
array - the array to look in
Returns:
the position in the array

wildcardMatch

public static boolean wildcardMatch(String in,
                                    String expression)
Checks if a given string matches a wildcard expression. For example:

Given "testingstring"
And "test*ing"

This method would return true as there is a match.

Parameters:
in - the string to check
expression - the wildcard expression to match against
Returns:
if there is a match

toString

public String toString()
Overrides the Object.toString() method to provide clean logging (every class should have this). This uses the uk.org.iscream.cms.server.util.FormatName class to format the toString()

Returns:
the name of this class and its CVS revision


Copyright © 2000-2003 i-scream. All Rights Reserved.