fun String.likeACow() = "Moo $this mooo"
Same thing in Kotlin, super handy.
EDIT: A big advantage with for example the JavaScript version monkey-patching String.prototype, is that the String class is not modified everywhere in your codebase.
String
It works like a normal function, you import the new function only if and where you need it. See kotlinlang.org/docs/extensions.htm...
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Same thing in Kotlin, super handy.
EDIT: A big advantage with for example the JavaScript version monkey-patching String.prototype, is that the
Stringclass is not modified everywhere in your codebase.It works like a normal function, you import the new function only if and where you need it. See kotlinlang.org/docs/extensions.htm...