更新List.join方法

This commit is contained in:
Armamem0t 2025-09-18 09:22:55 +08:00
parent 58806e85f1
commit 496c3e6248
Signed by: minglipro
GPG Key ID: 5F355A77B22AA93B

View File

@ -172,6 +172,13 @@ fun split(str: String, separator: String): List<String> {
}
fun List<String>.join(separator: String): String {
return this.joinToString(separator)
val sb = StringBuilder()
for (i in this.indices) {
sb.append(this[i])
if (i != this.size - 1) {
sb.append(separator)
}
}
return sb.toString()
}