Remove timeout in serverSocket, it not required and fix compatibility with Jsun...
[phpeclipse.git] / net.sourceforge.phpeclipse.externaltools / src / net / sourceforge / phpdt / externaltools / util / StringUtil.java
index c5ef81d..75bc572 100644 (file)
@@ -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();
-  }
-  
 }