I'm reading the Kotlin `String` API and have a few...
# getting-started
e
I'm reading the Kotlin
String
API and have a few questions... https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/
Why are there both functions and extension functions? Since Kotlin owns
kotlin.String
, why not build in any functions they want?
Why is there both
kotlin.String
and
kotlin.text.String
? https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/-string.html
The latter appears to just contain constructors.
f
e
(I see the article cites my favorite talk, Guy Steele's "Growing a Language".)
g
kotlin.String - is actual class kotlin.text.String - builder function which emulates string constructor, but implemented as part of String utils as top level function, which is quite common pattern in Kotlin
🙏 1