Whats the best way in kotlin for an null object’s toString() method to return an empty string instead of “null”
How about: nullable?.toString() ?: “” or as Alexander Udalov suggested: nullable?.toString().orEmpty() Which one can wrap in an extension method: fun Any?.toStringOrEmpty() = this?.toString() ?: “”