You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@empire-db.apache.org by do...@apache.org on 2012/12/03 11:15:10 UTC
svn commit: r1416411 -
/empire-db/trunk/empire-db/src/main/java/org/apache/empire/commons/StringUtils.java
Author: doebele
Date: Mon Dec 3 10:15:09 2012
New Revision: 1416411
URL: http://svn.apache.org/viewvc?rev=1416411&view=rev
Log:
EMPIREDB-174
new remove overload in StringUtils and javadoc spellcheck errors
Modified:
empire-db/trunk/empire-db/src/main/java/org/apache/empire/commons/StringUtils.java
Modified: empire-db/trunk/empire-db/src/main/java/org/apache/empire/commons/StringUtils.java
URL: http://svn.apache.org/viewvc/empire-db/trunk/empire-db/src/main/java/org/apache/empire/commons/StringUtils.java?rev=1416411&r1=1416410&r2=1416411&view=diff
==============================================================================
--- empire-db/trunk/empire-db/src/main/java/org/apache/empire/commons/StringUtils.java (original)
+++ empire-db/trunk/empire-db/src/main/java/org/apache/empire/commons/StringUtils.java Mon Dec 3 10:15:09 2012
@@ -227,13 +227,13 @@ public class StringUtils
}
/**
- * Replaces all occurences of find in source by replace.
+ * Replaces all occurrences of find in source by replace.
*
* @param source the original String.
* @param find the String to be replaced
* @param replace the replacement string
*
- * @return a new string with all occurances of <code>find</code> in <code>source</code> replaced by <code>replace</code>
+ * @return a new string with all occurrences of <code>find</code> in <code>source</code> replaced by <code>replace</code>
*/
public static String replace(String source, String find, String replace)
{
@@ -263,7 +263,7 @@ public class StringUtils
* @param find the String to be replaced
* @param replace the replacement string
*
- * @return a new string with all occurances of <code>find</code> in <code>source</code> replaced by <code>replace</code>
+ * @return a new string with all occurrences of <code>find</code> in <code>source</code> replaced by <code>replace</code>
*/
public static String replaceAll(String s, String find, String replace)
{
@@ -299,6 +299,17 @@ public class StringUtils
// done
return b.toString();
}
+
+ /**
+ * Removes all occurrences of remove from s
+ * @param s the source string
+ * @param remove the string to remove
+ * @return the result string
+ */
+ public static String remove(String s, String remove)
+ {
+ return replaceAll(s, remove, null);
+ }
/**
* Removes all occurrences of c from s
@@ -306,7 +317,7 @@ public class StringUtils
* @param c the character to remove
* @return the result string
*/
- public static String removeChar(String s, char c)
+ public static String remove(String s, char c)
{
return replaceAll(s, String.valueOf(c), null);
}
@@ -318,7 +329,7 @@ public class StringUtils
*/
public static String removeBlanks(String s)
{
- return removeChar(s, ' ');
+ return remove(s, " ");
}
/**