Example usage for org.apache.commons.lang3.text StrBuilder replaceAll

List of usage examples for org.apache.commons.lang3.text StrBuilder replaceAll

Introduction

In this page you can find the example usage for org.apache.commons.lang3.text StrBuilder replaceAll.

Prototype

public StrBuilder replaceAll(final StrMatcher matcher, final String replaceStr) 

Source Link

Document

Replaces all matches within the builder with the replace string.

Usage

From source file:org.selenium.runner.services.SeleniumRunner.java

protected String injectValue(final String instruction) throws SeleniumRunnerException {
    if (instruction == null) {
        throw new SeleniumRunnerException("can't inject value in null instruction !");
    }/*from  w  w  w  . j a  va  2 s .  co m*/

    StrBuilder result = new StrBuilder(instruction);

    String keyPattern = null;
    for (String key : storedValues.keySet()) {
        keyPattern = "${" + key + "}";
        if (result.contains(keyPattern)) {
            result.replaceAll(keyPattern, storedValues.get(key));
        }
    }

    return result.toString();

}