Add an optional parameter to joinToString() and joinTo() functions: lambda function which maps the element to string.

#KT-5468 Fixed
This commit is contained in:
Ilya Gorbunov
2015-04-21 20:54:30 +03:00
parent c8a76f6344
commit d531d7130f
5 changed files with 67 additions and 53 deletions
@@ -240,6 +240,10 @@ class StringJVMTest {
val data2 = "verylongstring".toList()
val result2 = data2.joinToString("-", "[", "]", 11, "oops")
assertEquals("[v-e-r-y-l-o-n-g-s-t-r-oops]", result2)
val data3 = "a1/b".toList()
val result3 = data3.joinToString() { it.toUpperCase().toString() }
assertEquals("A, 1, /, B", result3)
}
test fun join() {