optimize for empty string case
This commit is contained in:
parent
6e8c7c41fe
commit
15b9e00888
|
@ -1007,6 +1007,9 @@ public class Strings {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String[] splitStringToArray(final String s, final char c) {
|
public static String[] splitStringToArray(final String s, final char c) {
|
||||||
|
if (s.length() == 0) {
|
||||||
|
return Strings.EMPTY_ARRAY;
|
||||||
|
}
|
||||||
final char[] chars = s.toCharArray();
|
final char[] chars = s.toCharArray();
|
||||||
int count = 1;
|
int count = 1;
|
||||||
for (final char x : chars) {
|
for (final char x : chars) {
|
||||||
|
|
Loading…
Reference in New Issue