public static String replace( String string, String repl, String with ) {
    if ( string != null && repl != null && with != null ) {
      return string.replaceAll( Pattern.quote( repl ), Matcher.quoteReplacement( with ) );
    } else {
      return null;
    }
  }
@Test
  public void testReplace() {
    final String source = "A journey of a thousand miles never begins";
    assertEquals( "A journey of a thousand miles begins with a single step", Const.replace( source, "never begins",
        "begins with a single step" ) );
    assertEquals( source, Const.replace( source, "evil", "good" ) );
    assertEquals( "short", Const.replace( "short", "long pattern", "replacement" ) );
    assertEquals( "", Const.replace( "", "anything", "something" ) );
    assertEquals( null, Const.replace( null, "test", "junk" ) );
    assertEquals( null, Const.replace( "test", null, "junk" ) );
    assertEquals( null, Const.replace( "test", "junk", null ) );
  }