toShortString

fun Any?.toShortString(): String

Extracts the essential information from an object (most usually a string), whose toString() call result has a similar format as the output of function toLongString . If the format is not similar, it simply returns this.toString() .

For example, returns "42.0" if this is a string "Double(42.0)". Returns "John 42, Peter 31" for string "EmployeeList{John 42, Peter 31}".

Typical usage: the toString() method of a large collection-like object should contain only a very short description of each collection item. This is done, for example, in itemsToString ().

Sources

Katlib source
Link copied to clipboard