Use StringBuilder in String.times()
Has better performance than StringBuffer
This commit is contained in:
parent
67ae85cf55
commit
9c44837d0c
|
@ -1,9 +1,9 @@
|
|||
package com.simplemobiletools.contacts.overloads
|
||||
|
||||
operator fun String.times(x: Int): String {
|
||||
val stringBuffer = StringBuffer()
|
||||
val sb = StringBuilder()
|
||||
for (i in 1..x) {
|
||||
stringBuffer.append(this)
|
||||
sb.append(this)
|
||||
}
|
||||
return stringBuffer.toString()
|
||||
return sb.toString()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue