You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by st...@apache.org on 2012/08/28 15:00:33 UTC
svn commit: r1378114 -
/maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/StringUtils.java
Author: struberg
Date: Tue Aug 28 13:00:33 2012
New Revision: 1378114
URL: http://svn.apache.org/viewvc?rev=1378114&view=rev
Log:
MSHARED-236 apply Apache Licensed changes from people who have an iCLA on file
I also fixed a few typos and bugs while I'm at it
Modified:
maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/StringUtils.java
Modified: maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/StringUtils.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/StringUtils.java?rev=1378114&r1=1378113&r2=1378114&view=diff
==============================================================================
--- maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/StringUtils.java (original)
+++ maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/StringUtils.java Tue Aug 28 13:00:33 2012
@@ -55,7 +55,7 @@ public class StringUtils
* <p><code>StringUtils</code> instances should NOT be constructed in
* standard programming. Instead, the class should be used as
* <code>StringUtils.trim(" foo ");</code>.</p>
- * <p/>
+ *
* <p>This constructor is public to permit tools that require a JavaBean
* manager to operate.</p>
*/
@@ -71,13 +71,13 @@ public class StringUtils
* ends of this String, handling <code>null</code> by returning
* an empty String.</p>
*
+ * @see java.lang.String#trim()
* @param str the String to check
* @return the trimmed text (never <code>null</code>)
- * @see java.lang.String#trim()
*/
public static String clean( String str )
{
- return (str == null ? "" : str.trim());
+ return ( str == null ? "" : str.trim() );
}
/**
@@ -85,18 +85,18 @@ public class StringUtils
* ends of this String, handling <code>null</code> by returning
* <code>null</code>.</p>
*
+ * @see java.lang.String#trim()
* @param str the String to check
* @return the trimmed text (or <code>null</code>)
- * @see java.lang.String#trim()
*/
public static String trim( String str )
{
- return (str == null ? null : str.trim());
+ return ( str == null ? null : str.trim() );
}
/**
* <p>Deletes all whitespaces from a String.</p>
- * <p/>
+ *
* <p>Whitespace is defined by
* {@link Character#isWhitespace(char)}.</p>
*
@@ -106,7 +106,7 @@ public class StringUtils
*/
public static String deleteWhitespace( String str )
{
- StringBuilder buffer = new StringBuilder();
+ StringBuffer buffer = new StringBuffer();
int sz = str.length();
for ( int i = 0; i < sz; i++ )
{
@@ -127,30 +127,30 @@ public class StringUtils
*/
public static boolean isNotEmpty( String str )
{
- return ((str != null) && (str.length() > 0));
+ return ( ( str != null ) && ( str.length() > 0 ) );
}
/**
* <p>Checks if a (trimmed) String is <code>null</code> or empty.</p>
- * <p/>
+ *
* <p><strong>Note:</strong> In future releases, this method will no longer trim the input string such that it works
* complementary to {@link #isNotEmpty(String)}. Code that wants to test for whitespace-only strings should be
* migrated to use {@link #isBlank(String)} instead.</p>
*
* @param str the String to check
* @return <code>true</code> if the String is <code>null</code>, or
- * length zero once trimmed
+ * length zero once trimmed
*/
public static boolean isEmpty( String str )
{
- return ((str == null) || (str.trim().length() == 0));
+ return ( ( str == null ) || ( str.trim().length() == 0 ) );
}
/**
* <p>
* Checks if a String is whitespace, empty ("") or null.
* </p>
- * <p/>
+ *
* <pre>
* StringUtils.isBlank(null) = true
* StringUtils.isBlank("") = true
@@ -166,7 +166,7 @@ public class StringUtils
public static boolean isBlank( String str )
{
int strLen;
- if ( str == null || (strLen = str.length()) == 0 )
+ if ( str == null || ( strLen = str.length() ) == 0 )
{
return true;
}
@@ -184,7 +184,7 @@ public class StringUtils
* <p>
* Checks if a String is not empty (""), not null and not whitespace only.
* </p>
- * <p/>
+ *
* <pre>
* StringUtils.isNotBlank(null) = false
* StringUtils.isNotBlank("") = false
@@ -207,52 +207,52 @@ public class StringUtils
/**
* <p>Compares two Strings, returning <code>true</code> if they are equal.</p>
- * <p/>
+ *
* <p><code>null</code>s are handled without exceptions. Two <code>null</code>
* references are considered to be equal. The comparison is case sensitive.</p>
*
+ * @see java.lang.String#equals(Object)
* @param str1 the first string
* @param str2 the second string
* @return <code>true</code> if the Strings are equal, case sensitive, or
- * both <code>null</code>
- * @see java.lang.String#equals(Object)
+ * both <code>null</code>
*/
public static boolean equals( String str1, String str2 )
{
- return (str1 == null ? str2 == null : str1.equals( str2 ));
+ return ( str1 == null ? str2 == null : str1.equals( str2 ) );
}
/**
* <p>Compares two Strings, returning <code>true</code> if they are equal ignoring
* the case.</p>
- * <p/>
+ *
* <p><code>Nulls</code> are handled without exceptions. Two <code>null</code>
* references are considered equal. Comparison is case insensitive.</p>
*
- * @param str1 the first string
- * @param str2 the second string
- * @return <code>true</code> if the Strings are equal, case insensitive, or
- * both <code>null</code>
* @see java.lang.String#equalsIgnoreCase(String)
+ * @param str1 the first string
+ * @param str2 the second string
+ * @return <code>true</code> if the Strings are equal, case insensitive, or
+ * both <code>null</code>
*/
public static boolean equalsIgnoreCase( String str1, String str2 )
{
- return (str1 == null ? str2 == null : str1.equalsIgnoreCase( str2 ));
+ return ( str1 == null ? str2 == null : str1.equalsIgnoreCase( str2 ) );
}
/**
* <p>Find the first index of any of a set of potential substrings.</p>
- * <p/>
+ *
* <p><code>null</code> String will return <code>-1</code>.</p>
*
- * @param str the String to check
+ * @param str the String to check
* @param searchStrs the Strings to search for
* @return the first index of any of the searchStrs in str
* @throws NullPointerException if any of searchStrs[i] is <code>null</code>
*/
public static int indexOfAny( String str, String[] searchStrs )
{
- if ( (str == null) || (searchStrs == null) )
+ if ( ( str == null ) || ( searchStrs == null ) )
{
return -1;
}
@@ -264,7 +264,7 @@ public class StringUtils
int tmp = 0;
for ( int i = 0; i < sz; i++ )
{
- tmp = str.indexOf( searchStrs[ i ] );
+ tmp = str.indexOf( searchStrs[i] );
if ( tmp == -1 )
{
continue;
@@ -276,22 +276,22 @@ public class StringUtils
}
}
- return (ret == Integer.MAX_VALUE) ? -1 : ret;
+ return ( ret == Integer.MAX_VALUE ) ? -1 : ret;
}
/**
* <p>Find the latest index of any of a set of potential substrings.</p>
- * <p/>
+ *
* <p><code>null</code> string will return <code>-1</code>.</p>
*
- * @param str the String to check
- * @param searchStrs the Strings to search for
+ * @param str the String to check
+ * @param searchStrs the Strings to search for
* @return the last index of any of the Strings
* @throws NullPointerException if any of searchStrs[i] is <code>null</code>
*/
public static int lastIndexOfAny( String str, String[] searchStrs )
{
- if ( (str == null) || (searchStrs == null) )
+ if ( ( str == null ) || ( searchStrs == null ) )
{
return -1;
}
@@ -300,7 +300,7 @@ public class StringUtils
int tmp = 0;
for ( int i = 0; i < sz; i++ )
{
- tmp = str.lastIndexOf( searchStrs[ i ] );
+ tmp = str.lastIndexOf( searchStrs[i] );
if ( tmp > ret )
{
ret = tmp;
@@ -314,13 +314,13 @@ public class StringUtils
/**
* <p>Gets a substring from the specified string avoiding exceptions.</p>
- * <p/>
+ *
* <p>A negative start position can be used to start <code>n</code>
* characters from the end of the String.</p>
*
- * @param str the String to get the substring from
+ * @param str the String to get the substring from
* @param start the position to start from, negative means
- * count back from the end of the String by this many characters
+ * count back from the end of the String by this many characters
* @return substring from start position
*/
public static String substring( String str, int start )
@@ -350,15 +350,15 @@ public class StringUtils
/**
* <p>Gets a substring from the specified String avoiding exceptions.</p>
- * <p/>
+ *
* <p>A negative start position can be used to start/end <code>n</code>
* characters from the end of the String.</p>
*
- * @param str the String to get the substring from
+ * @param str the String to get the substring from
* @param start the position to start from, negative means
- * count back from the end of the string by this many characters
- * @param end the position to end at (exclusive), negative means
- * count back from the end of the String by this many characters
+ * count back from the end of the string by this many characters
+ * @param end the position to end at (exclusive), negative means
+ * count back from the end of the String by this many characters
* @return substring from start position to end positon
*/
public static String substring( String str, int start, int end )
@@ -405,7 +405,7 @@ public class StringUtils
/**
* <p>Gets the leftmost <code>n</code> characters of a String.</p>
- * <p/>
+ *
* <p>If <code>n</code> characters are not available, or the
* String is <code>null</code>, the String will be returned without
* an exception.</p>
@@ -421,7 +421,7 @@ public class StringUtils
{
throw new IllegalArgumentException( "Requested String length " + len + " is less than zero" );
}
- if ( (str == null) || (str.length() <= len) )
+ if ( ( str == null ) || ( str.length() <= len ) )
{
return str;
}
@@ -433,7 +433,7 @@ public class StringUtils
/**
* <p>Gets the rightmost <code>n</code> characters of a String.</p>
- * <p/>
+ *
* <p>If <code>n</code> characters are not available, or the String
* is <code>null</code>, the String will be returned without an
* exception.</p>
@@ -449,7 +449,7 @@ public class StringUtils
{
throw new IllegalArgumentException( "Requested String length " + len + " is less than zero" );
}
- if ( (str == null) || (str.length() <= len) )
+ if ( ( str == null ) || ( str.length() <= len ) )
{
return str;
}
@@ -461,7 +461,7 @@ public class StringUtils
/**
* <p>Gets <code>n</code> characters from the middle of a String.</p>
- * <p/>
+ *
* <p>If <code>n</code> characters are not available, the remainder
* of the String will be returned without an exception. If the
* String is <code>null</code>, <code>null</code> will be returned.</p>
@@ -471,12 +471,12 @@ public class StringUtils
* @param len the length of the required String
* @return the leftmost characters
* @throws IndexOutOfBoundsException if pos is out of bounds
- * @throws IllegalArgumentException if len is less than zero
+ * @throws IllegalArgumentException if len is less than zero
*/
public static String mid( String str, int pos, int len )
{
- if ( (pos < 0) ||
- ((str != null) && (pos > str.length())) )
+ if ( ( pos < 0 ) ||
+ ( ( str != null ) && ( pos > str.length() ) ) )
{
throw new StringIndexOutOfBoundsException( "String index " + pos + " is out of bounds" );
}
@@ -488,7 +488,7 @@ public class StringUtils
{
return null;
}
- if ( str.length() <= (pos + len) )
+ if ( str.length() <= ( pos + len ) )
{
return str.substring( pos );
}
@@ -504,7 +504,7 @@ public class StringUtils
/**
* <p>Splits the provided text into a array, using whitespace as the
* separator.</p>
- * <p/>
+ *
* <p>The separator is not included in the returned String array.</p>
*
* @param str the String to parse
@@ -525,20 +525,20 @@ public class StringUtils
/**
* <p>Splits the provided text into a array, based on a given separator.</p>
- * <p/>
+ *
* <p>The separator is not included in the returned String array. The
* maximum number of splits to perfom can be controlled. A <code>null</code>
* separator will cause parsing to be on whitespace.</p>
- * <p/>
+ *
* <p>This is useful for quickly splitting a String directly into
* an array of tokens, instead of an enumeration of tokens (as
* <code>StringTokenizer</code> does).</p>
*
- * @param str The string to parse.
+ * @param str The string to parse.
* @param separator Characters used as the delimiters. If
- * <code>null</code>, splits on whitespace.
- * @param max The maximum number of elements to parse. The rest of the string to parse
- * will be contained in the last array element. A zero or negative value implies no limit.
+ * <code>null</code>, splits on whitespace.
+ * @param max The maximum number of elements to include in the
+ * array. A zero or negative value implies no limit.
* @return an array of parsed Strings
*/
public static String[] split( String str, String separator, int max )
@@ -556,32 +556,32 @@ public class StringUtils
}
int listSize = tok.countTokens();
- if ( (max > 0) && (listSize > max) )
+ if ( ( max > 0 ) && ( listSize > max ) )
{
listSize = max;
}
- String[] list = new String[ listSize ];
+ String[] list = new String[listSize];
int i = 0;
int lastTokenBegin = 0;
int lastTokenEnd = 0;
while ( tok.hasMoreTokens() )
{
- if ( (max > 0) && (i == listSize - 1) )
+ if ( ( max > 0 ) && ( i == listSize - 1 ) )
{
// In the situation where we hit the max yet have
// tokens left over in our input, the last list
// element gets all remaining text.
String endToken = tok.nextToken();
lastTokenBegin = str.indexOf( endToken, lastTokenEnd );
- list[ i ] = str.substring( lastTokenBegin );
+ list[i] = str.substring( lastTokenBegin );
break;
}
else
{
- list[ i ] = tok.nextToken();
- lastTokenBegin = str.indexOf( list[ i ], lastTokenEnd );
- lastTokenEnd = lastTokenBegin + list[ i ].length();
+ list[i] = tok.nextToken();
+ lastTokenBegin = str.indexOf( list[i], lastTokenEnd );
+ lastTokenEnd = lastTokenBegin + list[i].length();
}
i++;
}
@@ -590,10 +590,9 @@ public class StringUtils
// Joining
//--------------------------------------------------------------------------
-
/**
* <p>Concatenates elements of an array into a single String.</p>
- * <p/>
+ *
* <p>The difference from join is that concatenate has no delimiter.</p>
*
* @param array the array of values to concatenate.
@@ -607,11 +606,11 @@ public class StringUtils
/**
* <p>Joins the elements of the provided array into a single String
* containing the provided list of elements.</p>
- * <p/>
+ *
* <p>No delimiter is added before or after the list. A
* <code>null</code> separator is the same as a blank String.</p>
*
- * @param array the array of values to join together
+ * @param array the array of values to join together
* @param separator the separator character to use
* @return the joined String
*/
@@ -622,9 +621,9 @@ public class StringUtils
separator = "";
}
int arraySize = array.length;
- int bufSize = (arraySize == 0 ? 0 : (array[ 0 ].toString().length() +
- separator.length()) * arraySize);
- StringBuilder buf = new StringBuilder( bufSize );
+ int bufSize = ( arraySize == 0 ? 0 : ( array[0].toString().length() +
+ separator.length() ) * arraySize );
+ StringBuffer buf = new StringBuffer( bufSize );
for ( int i = 0; i < arraySize; i++ )
{
@@ -632,7 +631,7 @@ public class StringUtils
{
buf.append( separator );
}
- buf.append( array[ i ] );
+ buf.append( array[i] );
}
return buf.toString();
}
@@ -640,21 +639,21 @@ public class StringUtils
/**
* <p>Joins the elements of the provided <code>Iterator</code> into
* a single String containing the provided elements.</p>
- * <p/>
+ *
* <p>No delimiter is added before or after the list. A
* <code>null</code> separator is the same as a blank String.</p>
*
- * @param iterator the <code>Iterator</code> of values to join together
- * @param separator the separator character to use
+ * @param iterator the <code>Iterator</code> of values to join together
+ * @param separator the separator character to use
* @return the joined String
*/
- public static String join( Iterator iterator, String separator )
+ public static String join( Iterator<?> iterator, String separator )
{
if ( separator == null )
{
separator = "";
}
- StringBuilder buf = new StringBuilder( 256 ); // Java default is 16, probably too small
+ StringBuffer buf = new StringBuffer( 256 ); // Java default is 16, probably too small
while ( iterator.hasNext() )
{
buf.append( iterator.next() );
@@ -667,19 +666,20 @@ public class StringUtils
}
+
// Replacing
//--------------------------------------------------------------------------
/**
* <p>Replace a char with another char inside a larger String, once.</p>
- * <p/>
+ *
* <p>A <code>null</code> reference passed to this method is a no-op.</p>
*
+ * @see #replace(String text, char repl, char with, int max)
* @param text text to search and replace in
* @param repl char to search for
* @param with char to replace with
* @return the text with any replacements processed
- * @see #replace(String text, char repl, char with, int max)
*/
public static String replaceOnce( String text, char repl, char with )
{
@@ -688,14 +688,14 @@ public class StringUtils
/**
* <p>Replace all occurances of a char within another char.</p>
- * <p/>
+ *
* <p>A <code>null</code> reference passed to this method is a no-op.</p>
*
+ * @see #replace(String text, char repl, char with, int max)
* @param text text to search and replace in
* @param repl char to search for
* @param with char to replace with
* @return the text with any replacements processed
- * @see #replace(String text, char repl, char with, int max)
*/
public static String replace( String text, char repl, char with )
{
@@ -705,13 +705,13 @@ public class StringUtils
/**
* <p>Replace a char with another char inside a larger String,
* for the first <code>max</code> values of the search char.</p>
- * <p/>
+ *
* <p>A <code>null</code> reference passed to this method is a no-op.</p>
*
* @param text text to search and replace in
* @param repl char to search for
* @param with char to replace with
- * @param max maximum number of values to replace, or <=0 if no maximum
+ * @param max maximum number of values to replace, or <code>-1</code> if no maximum
* @return the text with any replacements processed
*/
public static String replace( String text, char repl, char with, int max )
@@ -721,14 +721,14 @@ public class StringUtils
/**
* <p>Replace a String with another String inside a larger String, once.</p>
- * <p/>
+ *
* <p>A <code>null</code> reference passed to this method is a no-op.</p>
*
+ * @see #replace(String text, String repl, String with, int max)
* @param text text to search and replace in
* @param repl String to search for
* @param with String to replace with
* @return the text with any replacements processed
- * @see #replace(String text, String repl, String with, int max)
*/
public static String replaceOnce( String text, String repl, String with )
{
@@ -737,14 +737,14 @@ public class StringUtils
/**
* <p>Replace all occurances of a String within another String.</p>
- * <p/>
+ *
* <p>A <code>null</code> reference passed to this method is a no-op.</p>
*
+ * @see #replace(String text, String repl, String with, int max)
* @param text text to search and replace in
* @param repl String to search for
* @param with String to replace with
* @return the text with any replacements processed
- * @see #replace(String text, String repl, String with, int max)
*/
public static String replace( String text, String repl, String with )
{
@@ -754,25 +754,25 @@ public class StringUtils
/**
* <p>Replace a String with another String inside a larger String,
* for the first <code>max</code> values of the search String.</p>
- * <p/>
+ *
* <p>A <code>null</code> reference passed to this method is a no-op.</p>
*
* @param text text to search and replace in
* @param repl String to search for
* @param with String to replace with
- * @param max maximum number of values to replace, or <=0 if no maximum
+ * @param max maximum number of values to replace, or <code>-1</code> if no maximum
* @return the text with any replacements processed
*/
public static String replace( String text, String repl, String with, int max )
{
- if ( (text == null) || (repl == null) || (with == null) || (repl.length() == 0) )
+ if ( ( text == null ) || ( repl == null ) || ( with == null ) || ( repl.length() == 0 ) )
{
return text;
}
- StringBuilder buf = new StringBuilder( text.length() );
+ StringBuffer buf = new StringBuffer( text.length() );
int start = 0, end = 0;
- while ( (end = text.indexOf( repl, start )) != -1 )
+ while ( ( end = text.indexOf( repl, start ) ) != -1 )
{
buf.append( text.substring( start, end ) ).append( with );
start = end + repl.length();
@@ -789,16 +789,16 @@ public class StringUtils
/**
* <p>Overlay a part of a String with another String.</p>
*
- * @param text String to do overlaying in
+ * @param text String to do overlaying in
* @param overlay String to overlay
- * @param start int to start overlaying at
- * @param end int to stop overlaying before
+ * @param start int to start overlaying at
+ * @param end int to stop overlaying before
* @return String with overlayed text
* @throws NullPointerException if text or overlay is <code>null</code>
*/
public static String overlayString( String text, String overlay, int start, int end )
{
- return new StringBuilder( start + overlay.length() + text.length() - end + 1 )
+ return new StringBuffer( start + overlay.length() + text.length() - end + 1 )
.append( text.substring( 0, start ) )
.append( overlay )
.append( text.substring( end ) )
@@ -810,11 +810,11 @@ public class StringUtils
/**
* <p>Center a String in a larger String of size <code>n</code>.<p>
- * <p/>
+ *
* <p>Uses spaces as the value to buffer the String with.
* Equivalent to <code>center(str, size, " ")</code>.</p>
*
- * @param str String to center
+ * @param str String to center
* @param size int size of new String
* @return String containing centered String
* @throws NullPointerException if str is <code>null</code>
@@ -826,15 +826,15 @@ public class StringUtils
/**
* <p>Center a String in a larger String of size <code>n</code>.</p>
- * <p/>
+ *
* <p>Uses a supplied String as the value to buffer the String with.</p>
*
- * @param str String to center
- * @param size int size of new String
+ * @param str String to center
+ * @param size int size of new String
* @param delim String to buffer the new String with
* @return String containing centered String
* @throws NullPointerException if str or delim is <code>null</code>
- * @throws ArithmeticException if delim is the empty String
+ * @throws ArithmeticException if delim is the empty String
*/
public static String center( String str, int size, String delim )
{
@@ -999,7 +999,7 @@ public class StringUtils
/**
* <p>Remove the last character from a String.</p>
- * <p/>
+ *
* <p>If the String ends in <code>\r\n</code>, then remove both
* of them.</p>
*
@@ -1061,10 +1061,9 @@ public class StringUtils
//--------------------------------------------------------------------------
// spec 3.10.6
-
/**
* <p>Escapes any values it finds into their String form.</p>
- * <p/>
+ *
* <p>So a tab becomes the characters <code>'\\'</code> and
* <code>'t'</code>.</p>
*
@@ -1077,7 +1076,7 @@ public class StringUtils
// improved with code from cybertiger@cyberiantiger.org
// unicode from him, and defaul for < 32's.
int sz = str.length();
- StringBuilder buffer = new StringBuilder( 2 * sz );
+ StringBuffer buffer = new StringBuffer( 2 * sz );
for ( int i = 0; i < sz; i++ )
{
char ch = str.charAt( i );
@@ -1119,7 +1118,7 @@ public class StringUtils
buffer.append( '\\' );
buffer.append( 'r' );
break;
- default:
+ default :
if ( ch > 0xf )
{
buffer.append( "\\u00" + Integer.toHexString( ch ) );
@@ -1147,7 +1146,7 @@ public class StringUtils
buffer.append( '\\' );
buffer.append( '\\' );
break;
- default:
+ default :
buffer.append( ch );
break;
}
@@ -1163,15 +1162,15 @@ public class StringUtils
* <p>Repeat a String <code>n</code> times to form a
* new string.</p>
*
- * @param str String to repeat
+ * @param str String to repeat
* @param repeat number of times to repeat str
* @return String with repeated String
* @throws NegativeArraySizeException if <code>repeat < 0</code>
- * @throws NullPointerException if str is <code>null</code>
+ * @throws NullPointerException if str is <code>null</code>
*/
public static String repeat( String str, int repeat )
{
- StringBuilder buffer = new StringBuilder( repeat * str.length() );
+ StringBuffer buffer = new StringBuffer( repeat * str.length() );
for ( int i = 0; i < repeat; i++ )
{
buffer.append( str );
@@ -1181,10 +1180,10 @@ public class StringUtils
/**
* <p>Right pad a String with spaces.</p>
- * <p/>
+ *
* <p>The String is padded to the size of <code>n</code>.</p>
*
- * @param str String to repeat
+ * @param str String to repeat
* @param size number of times to repeat str
* @return right padded String
* @throws NullPointerException if str is <code>null</code>
@@ -1196,19 +1195,19 @@ public class StringUtils
/**
* <p>Right pad a String with a specified string.</p>
- * <p/>
+ *
* <p>The String is padded to the size of <code>n</code>.</p>
*
- * @param str String to pad out
- * @param size size to pad to
+ * @param str String to pad out
+ * @param size size to pad to
* @param delim String to pad with
* @return right padded String
* @throws NullPointerException if str or delim is <code>null</code>
- * @throws ArithmeticException if delim is the empty String
+ * @throws ArithmeticException if delim is the empty String
*/
public static String rightPad( String str, int size, String delim )
{
- size = (size - str.length()) / delim.length();
+ size = ( size - str.length() ) / delim.length();
if ( size > 0 )
{
str += repeat( delim, size );
@@ -1218,10 +1217,10 @@ public class StringUtils
/**
* <p>Left pad a String with spaces.</p>
- * <p/>
+ *
* <p>The String is padded to the size of <code>n</code>.</p>
*
- * @param str String to pad out
+ * @param str String to pad out
* @param size size to pad to
* @return left padded String
* @throws NullPointerException if str or delim is <code>null</code>
@@ -1234,16 +1233,16 @@ public class StringUtils
/**
* Left pad a String with a specified string. Pad to a size of n.
*
- * @param str String to pad out
- * @param size size to pad to
+ * @param str String to pad out
+ * @param size size to pad to
* @param delim String to pad with
* @return left padded String
* @throws NullPointerException if str or delim is null
- * @throws ArithmeticException if delim is the empty string
+ * @throws ArithmeticException if delim is the empty string
*/
public static String leftPad( String str, int size, String delim )
{
- size = (size - str.length()) / delim.length();
+ size = ( size - str.length() ) / delim.length();
if ( size > 0 )
{
str = repeat( delim, size ) + str;
@@ -1268,11 +1267,11 @@ public class StringUtils
/**
* <p>Remove a specified String from the front and back of a
* String.</p>
- * <p/>
+ *
* <p>If whitespace is wanted to be removed, used the
* {@link #strip(java.lang.String)} method.</p>
*
- * @param str the String to remove a string from
+ * @param str the String to remove a string from
* @param delim the String to remove at start and end
* @return the stripped String
*/
@@ -1298,32 +1297,32 @@ public class StringUtils
* <p>Strip the specified delimiter from the front and back of
* every String in the array.</p>
*
- * @param strs the Strings to remove a String from
+ * @param strs the Strings to remove a String from
* @param delimiter the String to remove at start and end
* @return the stripped Strings
*/
public static String[] stripAll( String[] strs, String delimiter )
{
- if ( (strs == null) || (strs.length == 0) )
+ if ( ( strs == null ) || ( strs.length == 0 ) )
{
return strs;
}
int sz = strs.length;
- String[] newArr = new String[ sz ];
+ String[] newArr = new String[sz];
for ( int i = 0; i < sz; i++ )
{
- newArr[ i ] = strip( strs[ i ], delimiter );
+ newArr[i] = strip( strs[i], delimiter );
}
return newArr;
}
/**
* <p>Strip any of a supplied String from the end of a String.</p>
- * <p/>
+ *
* <p>If the strip String is <code>null</code>, whitespace is
* stripped.</p>
*
- * @param str the String to remove characters from
+ * @param str the String to remove characters from
* @param strip the String to remove
* @return the stripped String
*/
@@ -1337,14 +1336,14 @@ public class StringUtils
if ( strip == null )
{
- while ( (end != 0) && Character.isWhitespace( str.charAt( end - 1 ) ) )
+ while ( ( end != 0 ) && Character.isWhitespace( str.charAt( end - 1 ) ) )
{
end--;
}
}
else
{
- while ( (end != 0) && (strip.indexOf( str.charAt( end - 1 ) ) != -1) )
+ while ( ( end != 0 ) && ( strip.indexOf( str.charAt( end - 1 ) ) != -1 ) )
{
end--;
}
@@ -1354,11 +1353,11 @@ public class StringUtils
/**
* <p>Strip any of a supplied String from the start of a String.</p>
- * <p/>
+ *
* <p>If the strip String is <code>null</code>, whitespace is
* stripped.</p>
*
- * @param str the String to remove characters from
+ * @param str the String to remove characters from
* @param strip the String to remove
* @return the stripped String
*/
@@ -1375,14 +1374,14 @@ public class StringUtils
if ( strip == null )
{
- while ( (start != sz) && Character.isWhitespace( str.charAt( start ) ) )
+ while ( ( start != sz ) && Character.isWhitespace( str.charAt( start ) ) )
{
start++;
}
}
else
{
- while ( (start != sz) && (strip.indexOf( str.charAt( start ) ) != -1) )
+ while ( ( start != sz ) && ( strip.indexOf( str.charAt( start ) ) != -1 ) )
{
start++;
}
@@ -1427,7 +1426,7 @@ public class StringUtils
/**
* <p>Uncapitalise a String.</p>
- * <p/>
+ *
* <p>That is, convert the first character into lower-case.
* <code>null</code> is returned as <code>null</code>.</p>
*
@@ -1446,7 +1445,7 @@ public class StringUtils
}
else
{
- return new StringBuilder( str.length() )
+ return new StringBuffer( str.length() )
.append( Character.toLowerCase( str.charAt( 0 ) ) )
.append( str.substring( 1 ) )
.toString();
@@ -1455,7 +1454,7 @@ public class StringUtils
/**
* <p>Capitalise a String.</p>
- * <p/>
+ *
* <p>That is, convert the first character into title-case.
* <code>null</code> is returned as <code>null</code>.</p>
*
@@ -1474,7 +1473,7 @@ public class StringUtils
}
else
{
- return new StringBuilder( str.length() )
+ return new StringBuffer( str.length() )
.append( Character.toTitleCase( str.charAt( 0 ) ) )
.append( str.substring( 1 ) )
.toString();
@@ -1483,10 +1482,10 @@ public class StringUtils
/**
* <p>Swaps the case of String.</p>
- * <p/>
+ *
* <p>Properly looks after making sure the start of words
* are Titlecase and not Uppercase.</p>
- * <p/>
+ *
* <p><code>null</code> is returned as <code>null</code>.</p>
*
* @param str the String to swap the case of
@@ -1499,11 +1498,11 @@ public class StringUtils
return null;
}
int sz = str.length();
- StringBuilder buffer = new StringBuilder( sz );
+ StringBuffer buffer = new StringBuffer( sz );
boolean whitespace = false;
- char ch;
- char tmp;
+ char ch = 0;
+ char tmp = 0;
for ( int i = 0; i < sz; i++ )
{
@@ -1540,10 +1539,10 @@ public class StringUtils
/**
* <p>Capitalise all the words in a String.</p>
- * <p/>
+ *
* <p>Uses {@link Character#isWhitespace(char)} as a
* separator between words.</p>
- * <p/>
+ *
* <p><code>null</code> will return <code>null</code>.</p>
*
* @param str the String to capitalise
@@ -1556,7 +1555,7 @@ public class StringUtils
return null;
}
int sz = str.length();
- StringBuilder buffer = new StringBuilder( sz );
+ StringBuffer buffer = new StringBuffer( sz );
boolean space = true;
for ( int i = 0; i < sz; i++ )
{
@@ -1581,13 +1580,13 @@ public class StringUtils
/**
* <p>Uncapitalise all the words in a string.</p>
- * <p/>
+ *
* <p>Uses {@link Character#isWhitespace(char)} as a
* separator between words.</p>
- * <p/>
+ *
* <p><code>null</code> will return <code>null</code>.</p>
*
- * @param str the string to uncapitalise
+ * @param str the string to uncapitalise
* @return uncapitalised string
*/
public static String uncapitaliseAllWords( String str )
@@ -1597,7 +1596,7 @@ public class StringUtils
return null;
}
int sz = str.length();
- StringBuilder buffer = new StringBuilder( sz );
+ StringBuffer buffer = new StringBuffer( sz );
boolean space = true;
for ( int i = 0; i < sz; i++ )
{
@@ -1626,7 +1625,7 @@ public class StringUtils
/**
* <p>Get the String that is nested in between two instances of the
* same String.</p>
- * <p/>
+ *
* <p>If <code>str</code> is <code>null</code>, will
* return <code>null</code>.</p>
*
@@ -1643,8 +1642,8 @@ public class StringUtils
/**
* <p>Get the String that is nested in between two Strings.</p>
*
- * @param str the String containing nested-string
- * @param open the String before nested-string
+ * @param str the String containing nested-string
+ * @param open the String before nested-string
* @param close the String after nested-string
* @return the String that was nested, or <code>null</code>
* @throws NullPointerException if open or close is <code>null</code>
@@ -1669,7 +1668,7 @@ public class StringUtils
/**
* <p>How many times is the substring in the larger String.</p>
- * <p/>
+ *
* <p><code>null</code> returns <code>0</code>.</p>
*
* @param str the String to check
@@ -1689,7 +1688,7 @@ public class StringUtils
}
int count = 0;
int idx = 0;
- while ( (idx = str.indexOf( sub, idx )) != -1 )
+ while ( ( idx = str.indexOf( sub, idx ) ) != -1 )
{
count++;
idx += sub.length();
@@ -1702,7 +1701,7 @@ public class StringUtils
/**
* <p>Checks if the String contains only unicode letters.</p>
- * <p/>
+ *
* <p><code>null</code> will return <code>false</code>.
* An empty String will return <code>true</code>.</p>
*
@@ -1728,7 +1727,7 @@ public class StringUtils
/**
* <p>Checks if the String contains only whitespace.</p>
- * <p/>
+ *
* <p><code>null</code> will return <code>false</code>. An
* empty String will return <code>true</code>.</p>
*
@@ -1744,7 +1743,7 @@ public class StringUtils
int sz = str.length();
for ( int i = 0; i < sz; i++ )
{
- if ( (Character.isWhitespace( str.charAt( i ) ) == false) )
+ if ( ( Character.isWhitespace( str.charAt( i ) ) == false ) )
{
return false;
}
@@ -1755,13 +1754,13 @@ public class StringUtils
/**
* <p>Checks if the String contains only unicode letters and
* space (<code>' '</code>).</p>
- * <p/>
+ *
* <p><code>null</code> will return <code>false</code>. An
* empty String will return <code>true</code>.</p>
*
* @param str the String to check
* @return <code>true</code> if only contains letters and space,
- * and is non-null
+ * and is non-null
*/
public static boolean isAlphaSpace( String str )
{
@@ -1772,8 +1771,8 @@ public class StringUtils
int sz = str.length();
for ( int i = 0; i < sz; i++ )
{
- if ( (Character.isLetter( str.charAt( i ) ) == false) &&
- (str.charAt( i ) != ' ') )
+ if ( ( Character.isLetter( str.charAt( i ) ) == false ) &&
+ ( str.charAt( i ) != ' ' ) )
{
return false;
}
@@ -1783,13 +1782,13 @@ public class StringUtils
/**
* <p>Checks if the String contains only unicode letters or digits.</p>
- * <p/>
+ *
* <p><code>null</code> will return <code>false</code>. An empty
* String will return <code>true</code>.</p>
*
* @param str the String to check
* @return <code>true</code> if only contains letters or digits,
- * and is non-null
+ * and is non-null
*/
public static boolean isAlphanumeric( String str )
{
@@ -1811,13 +1810,13 @@ public class StringUtils
/**
* <p>Checks if the String contains only unicode letters, digits
* or space (<code>' '</code>).</p>
- * <p/>
+ *
* <p><code>null</code> will return <code>false</code>. An empty
* String will return <code>true</code>.</p>
*
* @param str the String to check
* @return <code>true</code> if only contains letters, digits or space,
- * and is non-null
+ * and is non-null
*/
public static boolean isAlphanumericSpace( String str )
{
@@ -1828,8 +1827,8 @@ public class StringUtils
int sz = str.length();
for ( int i = 0; i < sz; i++ )
{
- if ( (Character.isLetterOrDigit( str.charAt( i ) ) == false) &&
- (str.charAt( i ) != ' ') )
+ if ( ( Character.isLetterOrDigit( str.charAt( i ) ) == false ) &&
+ ( str.charAt( i ) != ' ' ) )
{
return false;
}
@@ -1839,7 +1838,7 @@ public class StringUtils
/**
* <p>Checks if the String contains only unicode digits.</p>
- * <p/>
+ *
* <p><code>null</code> will return <code>false</code>.
* An empty String will return <code>true</code>.</p>
*
@@ -1866,13 +1865,13 @@ public class StringUtils
/**
* <p>Checks if the String contains only unicode digits or space
* (<code>' '</code>).</p>
- * <p/>
+ *
* <p><code>null</code> will return <code>false</code>. An empty
* String will return <code>true</code>.</p>
*
* @param str the String to check
* @return <code>true</code> if only contains digits or space,
- * and is non-null
+ * and is non-null
*/
public static boolean isNumericSpace( String str )
{
@@ -1883,8 +1882,8 @@ public class StringUtils
int sz = str.length();
for ( int i = 0; i < sz; i++ )
{
- if ( (Character.isDigit( str.charAt( i ) ) == false) &&
- (str.charAt( i ) != ' ') )
+ if ( ( Character.isDigit( str.charAt( i ) ) == false ) &&
+ ( str.charAt( i ) != ' ' ) )
{
return false;
}
@@ -1902,7 +1901,7 @@ public class StringUtils
*
* @param obj the Object to check
* @return the passed in Object's toString, or blank if it was
- * <code>null</code>
+ * <code>null</code>
*/
public static String defaultString( Object obj )
{
@@ -1914,15 +1913,15 @@ public class StringUtils
* or, if the <code>Object</code> is <code>null</code>, a passed
* in default String.</p>
*
- * @param obj the Object to check
- * @param defaultString the default String to return if str is
- * <code>null</code>
+ * @param obj the Object to check
+ * @param defaultString the default String to return if str is
+ * <code>null</code>
* @return the passed in string, or the default if it was
- * <code>null</code>
+ * <code>null</code>
*/
public static String defaultString( Object obj, String defaultString )
{
- return (obj == null) ? defaultString : obj.toString();
+ return ( obj == null ) ? defaultString : obj.toString();
}
// Reversing
@@ -1930,7 +1929,7 @@ public class StringUtils
/**
* <p>Reverse a String.</p>
- * <p/>
+ *
* <p><code>null</code> String returns <code>null</code>.</p>
*
* @param str the String to reverse
@@ -1942,17 +1941,17 @@ public class StringUtils
{
return null;
}
- return new StringBuilder( str ).reverse().toString();
+ return new StringBuffer( str ).reverse().toString();
}
/**
* <p>Reverses a String that is delimited by a specific character.</p>
- * <p/>
+ *
* <p>The Strings between the delimiters are not reversed.
* Thus java.lang.String becomes String.lang.java (if the delimiter
* is <code>'.'</code>).</p>
*
- * @param str the String to reverse
+ * @param str the String to reverse
* @param delimiter the delimiter to use
* @return the reversed String
*/
@@ -1967,10 +1966,10 @@ public class StringUtils
/**
* <p>Reverses an array.</p>
- * <p/>
+ *
* <p>TAKEN FROM CollectionsUtils.</p>
*
- * @param array the array to reverse
+ * @param array the array to reverse
*/
private static void reverseArray( Object[] array )
{
@@ -1980,9 +1979,9 @@ public class StringUtils
while ( j > i )
{
- tmp = array[ j ];
- array[ j ] = array[ i ];
- array[ i ] = tmp;
+ tmp = array[j];
+ array[j] = array[i];
+ array[i] = tmp;
j--;
i++;
}
@@ -1993,16 +1992,16 @@ public class StringUtils
/**
* Turn "Now is the time for all good men" into "Now is the time for..."
- * <p/>
+ * <p>
* Specifically:
- * <p/>
+ * <p>
* If str is less than max characters long, return it.
* Else abbreviate it to (substring(str, 0, max-3) + "...").
* If maxWidth is less than 3, throw an IllegalArgumentException.
* In no case will it return a string of length greater than maxWidth.
*
* @param maxWidth maximum length of result string
- */
+ **/
public static String abbreviate( String s, int maxWidth )
{
return abbreviate( s, 0, maxWidth );
@@ -2010,16 +2009,16 @@ public class StringUtils
/**
* Turn "Now is the time for all good men" into "...is the time for..."
- * <p/>
+ * <p>
* Works like abbreviate(String, int), but allows you to specify a "left edge"
* offset. Note that this left edge is not necessarily going to be the leftmost
* character in the result, or the first
* character following the ellipses, but it will appear somewhere in the result.
* In no case will it return a string of length greater than maxWidth.
*
- * @param offset left edge of source string
+ * @param offset left edge of source string
* @param maxWidth maximum length of result string
- */
+ **/
public static String abbreviate( String s, int offset, int maxWidth )
{
if ( maxWidth < 4 )
@@ -2034,9 +2033,9 @@ public class StringUtils
{
offset = s.length();
}
- if ( (s.length() - offset) < (maxWidth - 3) )
+ if ( ( s.length() - offset ) < ( maxWidth - 3 ) )
{
- offset = s.length() - (maxWidth - 3);
+ offset = s.length() - ( maxWidth - 3 );
}
if ( offset <= 4 )
{
@@ -2046,11 +2045,11 @@ public class StringUtils
{
throw new IllegalArgumentException( "Minimum abbreviation width with offset is 7" );
}
- if ( (offset + (maxWidth - 3)) < s.length() )
+ if ( ( offset + ( maxWidth - 3 ) ) < s.length() )
{
return "..." + abbreviate( s.substring( offset ), maxWidth - 3 );
}
- return "..." + s.substring( s.length() - (maxWidth - 3) );
+ return "..." + s.substring( s.length() - ( maxWidth - 3 ) );
}
// Difference
@@ -2060,11 +2059,11 @@ public class StringUtils
* Compare two strings, and return the portion where they differ.
* (More precisely, return the remainder of the second string,
* starting from where it's different from the first.)
- * <p/>
+ * <p>
* E.g. strdiff("i am a machine", "i am a robot") -> "robot"
*
* @return the portion of s2 where it differs from s1; returns the empty string ("") if they are equal
- */
+ **/
public static String difference( String s1, String s2 )
{
int at = differenceAt( s1, s2 );
@@ -2082,18 +2081,18 @@ public class StringUtils
* </p>
*
* @return the index where s2 and s1 begin to differ; -1 if they are equal
- */
+ **/
public static int differenceAt( String s1, String s2 )
{
int i;
- for ( i = 0; (i < s1.length()) && (i < s2.length()); ++i )
+ for ( i = 0; ( i < s1.length() ) && ( i < s2.length() ); ++i )
{
if ( s1.charAt( i ) != s2.charAt( i ) )
{
break;
}
}
- if ( (i < s2.length()) || (i < s1.length()) )
+ if ( ( i < s2.length() ) || ( i < s1.length() ) )
{
return i;
}
@@ -2111,7 +2110,7 @@ public class StringUtils
*/
public static String interpolate( String text, Map namespace )
{
- Iterator keys = namespace.keySet().iterator();
+ Iterator<?> keys = namespace.keySet().iterator();
while ( keys.hasNext() )
{
@@ -2153,7 +2152,7 @@ public class StringUtils
{
String temp;
- StringBuilder out = new StringBuilder();
+ StringBuffer out = new StringBuffer();
temp = data;
@@ -2161,7 +2160,7 @@ public class StringUtils
while ( st.hasMoreTokens() )
{
- String element = ( String ) st.nextElement();
+ String element = (String) st.nextElement();
out.append( capitalizeFirstLetter( element ) );
}
@@ -2216,21 +2215,21 @@ public class StringUtils
* <p/>
* 'ThisIsIt' will become 'this-is-it'.
*
- * @param input
+ * @param view
* @return deHumped string
*/
- public static String addAndDeHump( String input )
+ public static String addAndDeHump( String view )
{
- StringBuilder sb = new StringBuilder();
+ StringBuffer sb = new StringBuffer();
- for ( int i = 0; i < input.length(); i++ )
+ for ( int i = 0; i < view.length(); i++ )
{
- if ( (i != 0) && Character.isUpperCase( input.charAt( i ) ) )
+ if ( ( i != 0 ) && Character.isUpperCase( view.charAt( i ) ) )
{
sb.append( '-' );
}
- sb.append( input.charAt( i ) );
+ sb.append( view.charAt( i ) );
}
return sb.toString().trim().toLowerCase( Locale.ENGLISH );
@@ -2238,7 +2237,7 @@ public class StringUtils
/**
* <p>Quote and escape a String with the given character, handling <code>null</code>.</p>
- * <p/>
+ *
* <pre>
* StringUtils.quoteAndEscape(null, *) = null
* StringUtils.quoteAndEscape("", *) = ""
@@ -2252,6 +2251,7 @@ public class StringUtils
* @return the String quoted and escaped
* @see #quoteAndEscape(String, char, char[], char[], char, boolean)
* @since 1.5.1
+ * @see #quoteAndEscape(String, char, char[], char[], char, boolean)
*/
public static String quoteAndEscape( String source,
char quoteChar )
@@ -2318,7 +2318,7 @@ public class StringUtils
}
if ( !force && source.startsWith( Character.toString( quoteChar ) )
- && source.endsWith( Character.toString( quoteChar ) ) )
+ && source.endsWith( Character.toString( quoteChar ) ) )
{
return source;
}
@@ -2338,7 +2338,7 @@ public class StringUtils
{
for ( int i = 0; i < quotingTriggers.length; i++ )
{
- if ( escaped.indexOf( quotingTriggers[ i ] ) > -1 )
+ if ( escaped.indexOf( quotingTriggers[i] ) > -1 )
{
quote = true;
break;
@@ -2372,9 +2372,8 @@ public class StringUtils
System.arraycopy( escapedChars, 0, eqc, 0, escapedChars.length );
Arrays.sort( eqc );
- StringBuilder buffer = new StringBuilder( source.length() );
+ StringBuffer buffer = new StringBuffer( source.length() );
- int escapeCount = 0;
for ( int i = 0; i < source.length(); i++ )
{
final char c = source.charAt( i );
@@ -2383,9 +2382,7 @@ public class StringUtils
if ( result > -1 )
{
buffer.append( escapeChar );
- escapeCount++;
}
-
buffer.append( c );
}
@@ -2402,15 +2399,13 @@ public class StringUtils
*/
public static String removeDuplicateWhitespace( String s )
{
- StringBuilder result = new StringBuilder();
+ StringBuffer result = new StringBuffer( );
int length = s.length();
boolean isPreviousWhiteSpace = false;
- for ( int i = 0; i < length; i++ )
- {
+ for (int i = 0; i < length; i++){
char c = s.charAt( i );
boolean thisCharWhiteSpace = Character.isWhitespace( c );
- if ( !(isPreviousWhiteSpace && thisCharWhiteSpace) )
- {
+ if (!(isPreviousWhiteSpace && thisCharWhiteSpace)){
result.append( c );
}
isPreviousWhiteSpace = thisCharWhiteSpace;
@@ -2434,10 +2429,10 @@ public class StringUtils
/**
* Parses the given String and replaces all occurrences of
- * '\n', '\r' and '\r\n' with the given line separator.
+ * '\n', '\r' and '\r\n' with the system line separator.
*
- * @param s a not null String
- * @param ls the wanted line separator ("\n" on UNIX), if <code>null</code> using the System line separator.
+ * @param s a not null String
+ * @param ls the wanted line separator ("\n" on UNIX), if null using the System line separator.
* @return a String that contains only System line separators.
* @throws IllegalArgumentException if ls is not '\n', '\r' and '\r\n' characters.
* @since 1.5.7
@@ -2454,19 +2449,19 @@ public class StringUtils
ls = System.getProperty( "line.separator" );
}
- if ( !(ls.equals( "\n" ) || ls.equals( "\r" ) || ls.equals( "\r\n" )) )
+ if ( !( ls.equals( "\n" ) || ls.equals( "\r" ) || ls.equals( "\r\n" ) ) )
{
throw new IllegalArgumentException( "Requested line separator is invalid." );
}
int length = s.length();
- StringBuilder buffer = new StringBuilder( length );
+ StringBuffer buffer = new StringBuffer( length );
for ( int i = 0; i < length; i++ )
{
if ( s.charAt( i ) == '\r' )
{
- if ( (i + 1) < length && s.charAt( i + 1 ) == '\n' )
+ if ( ( i + 1 ) < length && s.charAt( i + 1 ) == '\n' )
{
i++;
}
@@ -2489,9 +2484,9 @@ public class StringUtils
/**
* <p>Checks if String contains a search character, handling <code>null</code>.
* This method uses {@link String#indexOf(int)}.</p>
- * <p/>
+ *
* <p>A <code>null</code> or empty ("") String will return <code>false</code>.</p>
- * <p/>
+ *
* <pre>
* StringUtils.contains(null, *) = false
* StringUtils.contains("", *) = false
@@ -2499,10 +2494,10 @@ public class StringUtils
* StringUtils.contains("abc", 'z') = false
* </pre>
*
- * @param str the String to check, may be null
- * @param searchChar the character to find
+ * @param str the String to check, may be null
+ * @param searchChar the character to find
* @return true if the String contains the search character,
- * false if not or <code>null</code> string input
+ * false if not or <code>null</code> string input
* @since 1.5.7
*/
public static boolean contains( String str, char searchChar )
@@ -2517,9 +2512,9 @@ public class StringUtils
/**
* <p>Checks if String contains a search String, handling <code>null</code>.
* This method uses {@link String#indexOf(int)}.</p>
- * <p/>
+ *
* <p>A <code>null</code> String will return <code>false</code>.</p>
- * <p/>
+ *
* <pre>
* StringUtils.contains(null, *) = false
* StringUtils.contains(*, null) = false
@@ -2529,10 +2524,10 @@ public class StringUtils
* StringUtils.contains("abc", "z") = false
* </pre>
*
- * @param str the String to check, may be null
- * @param searchStr the String to find, may be null
+ * @param str the String to check, may be null
+ * @param searchStr the String to find, may be null
* @return true if the String contains the search String,
- * false if not or <code>null</code> string input
+ * false if not or <code>null</code> string input
* @since 1.5.7
*/
public static boolean contains( String str, String searchStr )