diff options
Diffstat (limited to 'core/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt')
-rw-r--r-- | core/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt index cdb49ea..50a3c29 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/Utils.kt @@ -118,4 +118,8 @@ fun postDelayed(delay: Long, action: () -> Unit) { inline val kauIsMainThread: Boolean get() = Looper.myLooper() == Looper.getMainLooper() -class KauException(message: String) : RuntimeException(message)
\ No newline at end of file +class KauException(message: String) : RuntimeException(message) + +fun String.withMaxLength(n: Int): String = + if (length <= n) this + else substring(0, n-1) + KAU_ELLIPSIS
\ No newline at end of file |