2 * Created on 28.06.2003
5 package net.sourceforge.phpdt.internal.ui.util;
8 * some string utilities
11 public class StringUtil {
14 * Replace each substring of str which matches findStr with replaceStr
16 * @param str the string the substrings should be replaced in
17 * @param findStr the substring to be replaced
18 * @param replaceStr the replacement
19 * @return the resultstring
21 public static final String replaceAll(String str, String findStr, String replaceStr) {
22 StringBuffer buf = new StringBuffer();
26 while ((indexOf=str.indexOf(findStr, lastindex)) != -1) {
27 buf.append(str.substring(lastindex, indexOf)).append(replaceStr);
28 lastindex = indexOf + findStr.length();
30 buf.append(str.substring(lastindex));
31 return buf.toString();