javatools.util
Class SubstituteVariable

java.lang.Object
  |
  +--javatools.util.SubstituteVariable

public class SubstituteVariable
extends java.lang.Object

A utility class for substituting parts of Strings e.g. SubstituteVariable("${xx} brown fox jumped over ${xx} lazy dog", "${xx}", "the", 1); =>> "the quick brown fox jumped over ${xx} lazy dog" SubstituteVariable("${xx} brown fox jumped over ${xx} lazy dog", "${xx}", "the"); =>> "the quick brown fox jumped over the lazy dog"


Constructor Summary
SubstituteVariable()
           
 
Method Summary
static java.lang.String substitute(java.lang.String str, java.lang.String variable, java.lang.String value)
           
static java.lang.String substitute(java.lang.String str, java.lang.String variable, java.lang.String value, int num)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubstituteVariable

public SubstituteVariable()
Method Detail

substitute

public static java.lang.String substitute(java.lang.String str,
                                          java.lang.String variable,
                                          java.lang.String value)
Parameters:
str - String in which to do the substitutions
variable - The pattern to match and replace
value - The string to substitute into the string

substitute

public static java.lang.String substitute(java.lang.String str,
                                          java.lang.String variable,
                                          java.lang.String value,
                                          int num)
Parameters:
str - String in which to do the substitutions
variable - The pattern to match and replace
value - The string to substitute into the string