String.limit
This commit is contained in:
parent
56f4fe46a6
commit
1d77cf8f98
@ -82,3 +82,11 @@ fun <E : IStringSerializable> Collection<E>.valueOf(value: String): E {
|
|||||||
fun <T> Executor.supplyAsync(block: Supplier<T>): CompletableFuture<T> {
|
fun <T> Executor.supplyAsync(block: Supplier<T>): CompletableFuture<T> {
|
||||||
return CompletableFuture.supplyAsync(block, this)
|
return CompletableFuture.supplyAsync(block, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun String.limit(limit: Int = 40, replacer: String = "..."): String {
|
||||||
|
if (length <= limit) {
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
return substring(0, limit) + replacer
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user