Here’s a case I’ve just got.
data class Person(val firstName: String, val middleName: String? = null, val lastName: String) {
val fullName: String = "$firstName $middleName $lastName"
}
Here’s what I’m getting if middle name is NULL
John null Doe
What I have to do now is to add an emptyString constant which I can use in this string interpolation. It would be much simpler if language would offer this already.
I need to use NULL default value here, because this is stored in database and is send over several SOAP and REST requests.