We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
isNullOrEmpty
1 parent 430252a commit f8b8af4Copy full SHA for f8b8af4
_overviews/scala3-book/domain-modeling-tools.md
@@ -219,8 +219,7 @@ Here’s an example of a “string utilities” object that contains a set of me
219
object StringUtils:
220
def truncate(s: String, length: Int): String = s.take(length)
221
def containsWhitespace(s: String): Boolean = s.matches(".*\\s.*")
222
- def isNullOrEmpty(s: String): Boolean =
223
- if s == null || s.trim.equals("") then true else false
+ def isNullOrEmpty(s: String): Boolean = s==null || s.trim.isEmpty
224
```
225
226
We can use the object as follows:
0 commit comments