toCompact

fun Double.toCompact(decimals: Int = 1): String(source)

Abbreviates large numbers with K/M/B/T suffixes. Example: 1_500_000.0.toCompact() → "1.5M"


fun Long.toCompact(decimals: Int = 1): String(source)

See also