Tuesday, 26 August 2014

How to replace String/Characters from String

public String replaceBetweenString(String str, String prefix, String postfix, String replaceString) {
     String regex = "(" + prefix + ".*?" + postfix + ")";
     return str.replaceAll(regex, prefix + replaceString + postfix);
 }




No comments:

Post a Comment