[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:
parent
f416eb209c
commit
16774d1c0d
|
@ -124,6 +124,13 @@ public class StringUtils {
|
||||||
// String.concat about twice as fast as StringBuffer.append
|
// String.concat about twice as fast as StringBuffer.append
|
||||||
// (not sure who tested this)
|
// (not sure who tested this)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A String for a space character.
|
||||||
|
*
|
||||||
|
* @since 3.2
|
||||||
|
*/
|
||||||
|
public static final String SPACE = " ";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The empty String {@code ""}.
|
* The empty String {@code ""}.
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
|
@ -4581,7 +4588,7 @@ public class StringUtils {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (isEmpty(padStr)) {
|
if (isEmpty(padStr)) {
|
||||||
padStr = " ";
|
padStr = SPACE;
|
||||||
}
|
}
|
||||||
int padLen = padStr.length();
|
int padLen = padStr.length();
|
||||||
int strLen = str.length();
|
int strLen = str.length();
|
||||||
|
@ -4693,7 +4700,7 @@ public class StringUtils {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (isEmpty(padStr)) {
|
if (isEmpty(padStr)) {
|
||||||
padStr = " ";
|
padStr = SPACE;
|
||||||
}
|
}
|
||||||
int padLen = padStr.length();
|
int padLen = padStr.length();
|
||||||
int strLen = str.length();
|
int strLen = str.length();
|
||||||
|
@ -4832,7 +4839,7 @@ public class StringUtils {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
if (isEmpty(padStr)) {
|
if (isEmpty(padStr)) {
|
||||||
padStr = " ";
|
padStr = SPACE;
|
||||||
}
|
}
|
||||||
int strLen = str.length();
|
int strLen = str.length();
|
||||||
int pads = size - strLen;
|
int pads = size - strLen;
|
||||||
|
@ -6472,7 +6479,7 @@ public class StringUtils {
|
||||||
if (str == null) {
|
if (str == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return WHITESPACE_PATTERN.matcher(trim(str)).replaceAll(" ");
|
return WHITESPACE_PATTERN.matcher(trim(str)).replaceAll(SPACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue