itemsToString

inline fun <TItem> Iterable<TItem>.itemsToString(    itemsType: String = "items",     separator: String = ", ",     itemLength: Int = 30,     totalLength: Int = 200,     itemToString: (TItem) -> String = { item -> item.toShortString() }): String

Formats a collection of TItems to a readable string like "3 colors: red, yellow, green".

Each item is converted by itemToString to a string representation whose length is restricted by itemLength and the output length by totalLength. A separator (default = ", ") is placed between the string representation.

Parameters

itemsType

a string describing the collection items, such as "colors", "employees" etc.; default = "items"

itemToString

a lambda converting each item to its string representation.

Sources

Link copied to clipboard