WebDAV: remove static replace(str, repl, with) method.

Removed as unused, static and not a method we should be writing ourselves.



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@39167 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Matt Ward
2012-07-12 09:24:44 +00:00
parent ffd14c5ed3
commit b89348b1ad

View File

@@ -488,34 +488,6 @@ public class WebDAVHelper
return URLDecoder.decode(s);
}
/**
* Replace one string instance with another within the specified string
*
* @return Returns the replaced string
*/
public static String replace(String str, String repl, String with)
{
int lastindex = 0;
int pos = str.indexOf(repl);
// If no replacement needed, return the original string
// and save StringBuffer allocation/char copying
if (pos < 0)
{
return str;
}
int len = repl.length();
int lendiff = with.length() - repl.length();
StringBuilder out = new StringBuilder((lendiff <= 0) ? str.length() : (str.length() + (lendiff << 3)));
for (; pos >= 0; pos = str.indexOf(repl, lastindex = pos + len))
{
out.append(str.substring(lastindex, pos)).append(with);
}
return out.append(str.substring(lastindex, str.length())).toString();
}
/**
* Encodes the given string to valid HTML format
*