2 ms·
String in Kotlin can never be null. String? (with a question mark) can. Kotlin String == Go string Kotlin's String? == Go *string They're fully equivalent in
by unscaled 5y ago
String in Kotlin can never be null.
String? (with a question mark) can.
Kotlin String == Go string
Kotlin's String? == Go *string
They're fully equivalent in this regard.
If you wanted to note where Go strings are actually superior to Kotlin strings I'd give:
1. Go strings are slices. For immutable data that's pretty cool. I like it less when it comes to mutable arrays.
2. Go strings are single-byte UTF8, instead of wide-char UTF16. That's strictly superior.
Both of these limitations are probably due to the JVM, not Kotlin itself.