org.apache.cactus.internal.util
Class StringUtil

java.lang.Object
  extended by org.apache.cactus.internal.util.StringUtil

public class StringUtil
extends java.lang.Object

Various utility methods for string manipulation.

Version:
$Id: StringUtil.java 239169 2005-05-05 09:21:54Z vmassol $

Constructor Summary
StringUtil()
           
 
Method Summary
static java.lang.String exceptionToString(java.lang.Throwable theThrowable)
          Returns the stack trace of an exception as String.
static java.lang.String exceptionToString(java.lang.Throwable theThrowable, java.lang.String[] theFilterPatterns)
          Returns the stack trace of an exception as String, optionally filtering out line from the stack trac.
static boolean filterLine(java.lang.String theLine, java.lang.String[] theFilterPatterns)
           
static java.lang.String replace(java.lang.String theBaseString, char theChar, java.lang.String theNewString)
          Replaces a character in a string by a substring.
 
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

exceptionToString

public static java.lang.String exceptionToString(java.lang.Throwable theThrowable)
Returns the stack trace of an exception as String.

Parameters:
theThrowable - the exception from which to extract the stack trace as a String
Returns:
the exception stack trace as a String

exceptionToString

public static java.lang.String exceptionToString(java.lang.Throwable theThrowable,
                                                 java.lang.String[] theFilterPatterns)
Returns the stack trace of an exception as String, optionally filtering out line from the stack trac.

Parameters:
theThrowable - the exception from which to extract the stack trace as a String
theFilterPatterns - Array containing a list of patterns to filter out from the stack trace
Returns:
the exception stack trace as a String

filterLine

public static boolean filterLine(java.lang.String theLine,
                                 java.lang.String[] theFilterPatterns)
Parameters:
theLine - The line to check
theFilterPatterns - The patterns to filter out
Returns:
boolean Whether the specified line should be filtered from the stack trace

replace

public static java.lang.String replace(java.lang.String theBaseString,
                                       char theChar,
                                       java.lang.String theNewString)
Replaces a character in a string by a substring.

Parameters:
theBaseString - the base string in which to perform replacements
theChar - the char to look for
theNewString - the string with which to replace the char
Returns:
the string with replacements done or null if the input string was null


Copyright © 2001-2009 The Apache Software Foundation. All Rights Reserved.