mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-04-03 12:51:01 +02:00
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
|
package com.simplemobiletools.contacts.overloads
|
||||||
|
|
||||||
operator fun String.times(x: Int): String {
|
operator fun String.times(x: Int): String {
|
||||||
val stringBuffer = StringBuffer()
|
val sb = StringBuilder()
|
||||||
for (i in 1..x) {
|
for (i in 1..x) {
|
||||||
stringBuffer.append(this)
|
sb.append(this)
|
||||||
}
|
}
|
||||||
return stringBuffer.toString()
|
return sb.toString()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user