Add samples for joinToString

KT-20357
This commit is contained in:
gzoritchak
2018-02-11 00:16:41 +01:00
committed by ilya-g
parent a36e8c86f1
commit 40e3159463
11 changed files with 113 additions and 0 deletions
@@ -1155,6 +1155,8 @@ public fun <T, A : Appendable> Iterable<T>.joinTo(buffer: A, separator: CharSequ
*
* If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]
* elements will be appended, followed by the [truncated] string (which defaults to "...").
*
* @sample samples.collections.Collections.Transformations.joinToString
*/
public fun <T> Iterable<T>.joinToString(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((T) -> CharSequence)? = null): String {
return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString()