Reuse own API

This commit is contained in:
Gary Gregory 2022-10-27 09:51:05 -04:00
parent 0659831ad4
commit fb90d0bd85
3 changed files with 7 additions and 10 deletions

View File

@ -6716,8 +6716,7 @@ public class StringUtils {
// find the next earliest match
// NOTE: logic mostly duplicated above START
for (int i = 0; i < searchLength; i++) {
if (noMoreMatchesForReplIndex[i] || searchList[i] == null ||
searchList[i].isEmpty() || replacementList[i] == null) {
if (noMoreMatchesForReplIndex[i] || isEmpty(searchList[i]) || replacementList[i] == null) {
continue;
}
tempIndex = text.indexOf(searchList[i], start);

View File

@ -173,7 +173,7 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* @return this, to enable chaining
*/
public StrBuilder setNullText(String nullText) {
if (nullText != null && nullText.isEmpty()) {
if (StringUtils.isEmpty(nullText)) {
nullText = null;
}
this.nullText = nullText;

View File

@ -82,8 +82,8 @@ public class LocaleUtilsTest extends AbstractLangTest {
assertNotNull(locale, "valid locale");
assertEquals(language, locale.getLanguage());
//country and variant are empty
assertTrue(locale.getCountry() == null || locale.getCountry().isEmpty());
assertTrue(locale.getVariant() == null || locale.getVariant().isEmpty());
assertTrue(StringUtils.isEmpty(locale.getCountry()));
assertTrue(StringUtils.isEmpty(locale.getVariant()));
}
/**
@ -99,7 +99,7 @@ public class LocaleUtilsTest extends AbstractLangTest {
assertEquals(language, locale.getLanguage());
assertEquals(country, locale.getCountry());
//variant is empty
assertTrue(locale.getVariant() == null || locale.getVariant().isEmpty());
assertTrue(StringUtils.isEmpty(locale.getVariant()));
}
/**
@ -396,8 +396,7 @@ public class LocaleUtilsTest extends AbstractLangTest {
while (iterator.hasNext()) {
final Locale locale = iterator.next();
// should have an en empty variant
assertTrue(locale.getVariant() == null
|| locale.getVariant().isEmpty());
assertTrue(StringUtils.isEmpty(locale.getVariant()));
assertEquals(country, locale.getCountry());
if (language.equals(locale.getLanguage())) {
found = true;
@ -443,8 +442,7 @@ public class LocaleUtilsTest extends AbstractLangTest {
while (iterator.hasNext()) {
final Locale locale = iterator.next();
// should have an en empty variant
assertTrue(locale.getVariant() == null
|| locale.getVariant().isEmpty());
assertTrue(StringUtils.isEmpty(locale.getVariant()));
assertEquals(language, locale.getLanguage());
if (country.equals(locale.getCountry())) {
found = true;