diff options
author | mkuppe | 2008-05-30 12:22:17 +0000 |
---|---|---|
committer | mkuppe | 2008-05-30 12:22:17 +0000 |
commit | e814be085bae2608142e7937245b71cf0639ad18 (patch) | |
tree | 597e33c283eceb6b3ef2c8bc511b60a54776b859 /framework | |
parent | 61e41996719e0e4a60a9002207a5bdbc97f65660 (diff) | |
download | org.eclipse.ecf-e814be085bae2608142e7937245b71cf0639ad18.tar.gz org.eclipse.ecf-e814be085bae2608142e7937245b71cf0639ad18.tar.xz org.eclipse.ecf-e814be085bae2608142e7937245b71cf0639ad18.zip |
RESOLVED - bug 233807: Move replaceAllIgnoreCase to StringUtils
https://bugs.eclipse.org/bugs/show_bug.cgi?id=233807
Diffstat (limited to 'framework')
-rw-r--r-- | framework/bundles/org.eclipse.ecf.identity/META-INF/MANIFEST.MF | 2 | ||||
-rw-r--r-- | framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/StringUtils.java | 20 |
2 files changed, 21 insertions, 1 deletions
diff --git a/framework/bundles/org.eclipse.ecf.identity/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.identity/META-INF/MANIFEST.MF index 4f344ebc7..0ed853ecc 100644 --- a/framework/bundles/org.eclipse.ecf.identity/META-INF/MANIFEST.MF +++ b/framework/bundles/org.eclipse.ecf.identity/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %plugin.name Bundle-SymbolicName: org.eclipse.ecf.identity;singleton:=true -Bundle-Version: 2.0.0.qualifier +Bundle-Version: 2.1.0.qualifier Bundle-Activator: org.eclipse.ecf.internal.core.identity.Activator Bundle-Localization: plugin Bundle-Vendor: %plugin.provider diff --git a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/StringUtils.java b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/StringUtils.java index 939c61d04..01c4bf6a3 100644 --- a/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/StringUtils.java +++ b/framework/bundles/org.eclipse.ecf.identity/src/org/eclipse/ecf/core/util/StringUtils.java @@ -233,4 +233,24 @@ public final class StringUtils { return string; return string.substring(0, index) + replace + replaceAll(string.substring(index + target.length()), target, replace); } + + /** + * Returns the string resulting from replacing all occurrences of the target with the replace + * string. Note that the target matches literally but ignoring the case, and this is not the same behavior as the + * String.replaceAll, which uses regular expressions for doing the matching. + * @param string the start string. Must not be <code>null</code>. + * @param target the target to search for in the start string. Must not be <code>null</code>. + * @param replace the replacement string to substitute when the target is found. Must not be <code>null</code>. + * @return String result. Will not be <code>null</code>. If target is not found in the given string, + * then the result will be the entire input string. + * + * @see StringUtils#replaceAll(String, String, String) but case insensitive + */ + public static String replaceAllIgnoreCase(String string, String target, String replace) { + final int index = string.toLowerCase().indexOf(target.toLowerCase()); + if (index == -1) + return string; + return string.substring(0, index) + replace + replaceAllIgnoreCase(string.substring(index + target.length()), target, replace); + } + } |