mirror of
https://github.com/enso-org/enso.git
synced 2024-11-09 17:51:29 +03:00
Use .isEmpty()
instead of .length() == 0
(#3314)
Minor nit - since String is a CharSequence it's advisable to use the corresponding method for checking the condition rather than writing it by hand.
This commit is contained in:
parent
8bdca89917
commit
ac5c02ed8c
@ -170,8 +170,8 @@ public class Text_Utils {
|
|||||||
public static boolean contains(String string, String substring) {
|
public static boolean contains(String string, String substring) {
|
||||||
// {@code StringSearch} does not handle empty strings as we would want, so we need these special
|
// {@code StringSearch} does not handle empty strings as we would want, so we need these special
|
||||||
// cases.
|
// cases.
|
||||||
if (substring.length() == 0) return true;
|
if (substring.isEmpty()) return true;
|
||||||
if (string.length() == 0) return false;
|
if (string.isEmpty()) return false;
|
||||||
StringSearch searcher = new StringSearch(substring, string);
|
StringSearch searcher = new StringSearch(substring, string);
|
||||||
return searcher.first() != StringSearch.DONE;
|
return searcher.first() != StringSearch.DONE;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ public class Parser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String handleNa(String raw) {
|
private String handleNa(String raw) {
|
||||||
if (raw == null || raw.length() == 0) {
|
if (raw == null || raw.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return raw;
|
return raw;
|
||||||
|
Loading…
Reference in New Issue
Block a user