X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/util/StringUtil.java b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/util/StringUtil.java index c5ef81d..75bc572 100644 --- a/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/util/StringUtil.java +++ b/net.sourceforge.phpeclipse.externaltools/src/net/sourceforge/phpdt/externaltools/util/StringUtil.java @@ -6,29 +6,33 @@ package net.sourceforge.phpdt.externaltools.util; /** * some string utilities - * + * */ public class StringUtil { - /** - * Replace each substring of str which matches findStr with replaceStr - * - * @param str the string the substrings should be replaced in - * @param findStr the substring to be replaced - * @param replaceStr the replacement - * @return the resultstring - */ - public static final String replaceAll(String str, String findStr, String replaceStr) { - StringBuffer buf = new StringBuffer(); + /** + * Replace each substring of str which matches findStr with replaceStr + * + * @param str + * the string the substrings should be replaced in + * @param findStr + * the substring to be replaced + * @param replaceStr + * the replacement + * @return the resultstring + */ + public static final String replaceAll(String str, String findStr, + String replaceStr) { + StringBuffer buf = new StringBuffer(); + + int lastindex = 0; + int indexOf = 0; + while ((indexOf = str.indexOf(findStr, lastindex)) != -1) { + buf.append(str.substring(lastindex, indexOf)).append(replaceStr); + lastindex = indexOf + findStr.length(); + } + buf.append(str.substring(lastindex)); + return buf.toString(); + } - int lastindex = 0; - int indexOf = 0; - while ((indexOf=str.indexOf(findStr, lastindex)) != -1) { - buf.append(str.substring(lastindex, indexOf)).append(replaceStr); - lastindex = indexOf + findStr.length(); - } - buf.append(str.substring(lastindex)); - return buf.toString(); - } - }