mirror of
https://github.com/apache/commons-lang.git
synced 2025-02-07 02:28:25 +00:00
Reuse own API
This commit is contained in:
parent
0659831ad4
commit
fb90d0bd85
@ -6716,8 +6716,7 @@ private static String replaceEach(
|
|||||||
// find the next earliest match
|
// find the next earliest match
|
||||||
// NOTE: logic mostly duplicated above START
|
// NOTE: logic mostly duplicated above START
|
||||||
for (int i = 0; i < searchLength; i++) {
|
for (int i = 0; i < searchLength; i++) {
|
||||||
if (noMoreMatchesForReplIndex[i] || searchList[i] == null ||
|
if (noMoreMatchesForReplIndex[i] || isEmpty(searchList[i]) || replacementList[i] == null) {
|
||||||
searchList[i].isEmpty() || replacementList[i] == null) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
tempIndex = text.indexOf(searchList[i], start);
|
tempIndex = text.indexOf(searchList[i], start);
|
||||||
|
@ -173,7 +173,7 @@ public String getNullText() {
|
|||||||
* @return this, to enable chaining
|
* @return this, to enable chaining
|
||||||
*/
|
*/
|
||||||
public StrBuilder setNullText(String nullText) {
|
public StrBuilder setNullText(String nullText) {
|
||||||
if (nullText != null && nullText.isEmpty()) {
|
if (StringUtils.isEmpty(nullText)) {
|
||||||
nullText = null;
|
nullText = null;
|
||||||
}
|
}
|
||||||
this.nullText = nullText;
|
this.nullText = nullText;
|
||||||
|
@ -82,8 +82,8 @@ private static void assertValidToLocale(final String language) {
|
|||||||
assertNotNull(locale, "valid locale");
|
assertNotNull(locale, "valid locale");
|
||||||
assertEquals(language, locale.getLanguage());
|
assertEquals(language, locale.getLanguage());
|
||||||
//country and variant are empty
|
//country and variant are empty
|
||||||
assertTrue(locale.getCountry() == null || locale.getCountry().isEmpty());
|
assertTrue(StringUtils.isEmpty(locale.getCountry()));
|
||||||
assertTrue(locale.getVariant() == null || locale.getVariant().isEmpty());
|
assertTrue(StringUtils.isEmpty(locale.getVariant()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -99,7 +99,7 @@ private static void assertValidToLocale(final String localeString, final String
|
|||||||
assertEquals(language, locale.getLanguage());
|
assertEquals(language, locale.getLanguage());
|
||||||
assertEquals(country, locale.getCountry());
|
assertEquals(country, locale.getCountry());
|
||||||
//variant is empty
|
//variant is empty
|
||||||
assertTrue(locale.getVariant() == null || locale.getVariant().isEmpty());
|
assertTrue(StringUtils.isEmpty(locale.getVariant()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -396,8 +396,7 @@ private static void assertLanguageByCountry(final String country, final String[]
|
|||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
final Locale locale = iterator.next();
|
final Locale locale = iterator.next();
|
||||||
// should have an en empty variant
|
// should have an en empty variant
|
||||||
assertTrue(locale.getVariant() == null
|
assertTrue(StringUtils.isEmpty(locale.getVariant()));
|
||||||
|| locale.getVariant().isEmpty());
|
|
||||||
assertEquals(country, locale.getCountry());
|
assertEquals(country, locale.getCountry());
|
||||||
if (language.equals(locale.getLanguage())) {
|
if (language.equals(locale.getLanguage())) {
|
||||||
found = true;
|
found = true;
|
||||||
@ -443,8 +442,7 @@ private static void assertCountriesByLanguage(final String language, final Strin
|
|||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
final Locale locale = iterator.next();
|
final Locale locale = iterator.next();
|
||||||
// should have an en empty variant
|
// should have an en empty variant
|
||||||
assertTrue(locale.getVariant() == null
|
assertTrue(StringUtils.isEmpty(locale.getVariant()));
|
||||||
|| locale.getVariant().isEmpty());
|
|
||||||
assertEquals(language, locale.getLanguage());
|
assertEquals(language, locale.getLanguage());
|
||||||
if (country.equals(locale.getCountry())) {
|
if (country.equals(locale.getCountry())) {
|
||||||
found = true;
|
found = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user