[LANG-701] StringUtils join with var args. Add and use SPACE string constant for " ".

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1407148 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary D. Gregory 2012-11-08 16:08:23 +00:00
parent f416eb209c
commit 16774d1c0d
1 changed files with 11 additions and 4 deletions

View File

@ -124,6 +124,13 @@ public class StringUtils {
// String.concat about twice as fast as StringBuffer.append
// (not sure who tested this)
/**
* A String for a space character.
*
* @since 3.2
*/
public static final String SPACE = " ";
/**
* The empty String {@code ""}.
* @since 2.0
@ -4581,7 +4588,7 @@ public class StringUtils {
return null;
}
if (isEmpty(padStr)) {
padStr = " ";
padStr = SPACE;
}
int padLen = padStr.length();
int strLen = str.length();
@ -4693,7 +4700,7 @@ public class StringUtils {
return null;
}
if (isEmpty(padStr)) {
padStr = " ";
padStr = SPACE;
}
int padLen = padStr.length();
int strLen = str.length();
@ -4832,7 +4839,7 @@ public class StringUtils {
return str;
}
if (isEmpty(padStr)) {
padStr = " ";
padStr = SPACE;
}
int strLen = str.length();
int pads = size - strLen;
@ -6472,7 +6479,7 @@ public class StringUtils {
if (str == null) {
return null;
}
return WHITESPACE_PATTERN.matcher(trim(str)).replaceAll(" ");
return WHITESPACE_PATTERN.matcher(trim(str)).replaceAll(SPACE);
}
/**