Join Slack
Powered by
Hello everyone! I want to use maxOf with 2 strings...
# getting-started
a
Alejo
10/07/2021, 6:31 PM
Hello everyone! I want to use maxOf with 2 strings but compare by the String.length. Something like
maxOf("aaaa","zzz")
and return
"aaaa"
. How could I achieve this?
r
Ruckus
10/07/2021, 7:14 PM
Use a comparator:
Copy code
maxOf("aaaa", "zzz", compareBy { it.length })
a
Alejo
10/07/2021, 7:28 PM
Awesome!!! Thanks
@Ruckus
👍 1
2
Views
Open in Slack
Previous
Next