mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 03:07:25 +01:00
Change string chop method default to use smaller ... instead
(cherry picked from commit 43b42f8d54bf8872b4fd2467b33fa06a9a44dbb6)
This commit is contained in:
parent
f0eacf4218
commit
6a4c280235
@ -7,7 +7,7 @@ import kotlin.math.floor
|
|||||||
* Replaces the given string to have at most [count] characters using [replacement] at its end.
|
* Replaces the given string to have at most [count] characters using [replacement] at its end.
|
||||||
* If [replacement] is longer than [count] an exception will be thrown when `length > count`.
|
* If [replacement] is longer than [count] an exception will be thrown when `length > count`.
|
||||||
*/
|
*/
|
||||||
fun String.chop(count: Int, replacement: String = "..."): String {
|
fun String.chop(count: Int, replacement: String = "…"): String {
|
||||||
return if (length > count) {
|
return if (length > count) {
|
||||||
take(count - replacement.length) + replacement
|
take(count - replacement.length) + replacement
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user