Join Slack
Powered by
Is there any built-in for `String` to ensure that ...
# announcements
p
poohbar
01/26/2020, 2:27 AM
Is there any built-in for
String
to ensure that a string ends with a certain character? Also called "append if missing" in some libraries. e.g.
foo("word", ".")
->
word.
foo("word.", ".")
->
word.
n
nils
01/26/2020, 4:35 AM
Kotlin does not have this built-in function, as far as I know. However, would this work for you?
Snippet.kt
Open in Slack
Previous
Next