From 97fc1d6239c92d4edcdd12a0ae329218705d1fef Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 2 Sep 2021 14:01:01 +0600 Subject: [PATCH] small addition to joinTo --- .../kotlin/dev/inmo/micro_utils/common/JoinTo.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/JoinTo.kt b/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/JoinTo.kt index 553c4f77783..ddff9db3da7 100644 --- a/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/JoinTo.kt +++ b/common/src/commonMain/kotlin/dev/inmo/micro_utils/common/JoinTo.kt @@ -25,9 +25,23 @@ inline fun Iterable.joinTo( return result } +inline fun Iterable.joinTo( + separator: R?, + prefix: R?, + postfix: R?, + crossinline transform: (I) -> R? +): List = joinTo({ separator }, prefix, postfix, transform) + inline fun Array.joinTo( crossinline separatorFun: (I) -> R?, prefix: R?, postfix: R?, crossinline transform: (I) -> R? ): Array = asIterable().joinTo(separatorFun, prefix, postfix, transform).toTypedArray() + +inline fun Array.joinTo( + separator: R?, + prefix: R?, + postfix: R?, + crossinline transform: (I) -> R? +): Array = asIterable().joinTo(separator, prefix, postfix, transform).toTypedArray()