public String replaceText(String originalStr, String oldStr,
            String newStr) {
        if (oldStr == null || newStr == null || oldStr.equals(newStr)) {
            return originalStr;
        }
        return originalStr.replace(oldStr, newStr);
    }
public String replaceText ( String originalStr , String oldStr , String newStr ) { if ( oldStr == null || newStr == null || oldStr . equals ( newStr ) ) { return originalStr ; } return originalStr . replace ( oldStr , newStr ) ; }
Given a string, replace all occurrences of 'newStr' with 'oldStr'.
@param originalStr the string to modify.
@param oldStr the string to replace.
@param newStr the string to insert in place of the old string.