toString

inline fun Any?.toString(): String

A null-safe version of the standard toString() function.

If the object is null, it returns the string "null". Otherwise, it calls the object's regular toString() method. This is particularly useful for logging and debugging, preventing NullPointerException when concatenating strings.

Return

The string representation of the object, or "null" if the object is null.