mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
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:
@@ -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
|
||||
*
|
||||
|
Reference in New Issue
Block a user