Package-level declarations

Functions

Link copied to clipboard

Converts bits per second to bytes per second. Example: 8_000_000.0.bpsToBytes() → 1_000_000.0

Link copied to clipboard
fun Double.bpsToHuman(decimals: Int = 1): String

Formats a bits-per-second value as a human-readable bandwidth string. Example: 1_500_000.0.bpsToHuman() → "1.5 Mbps"

Link copied to clipboard
fun Double.bytesPerSecToHuman(decimals: Int = 1): String

Formats a bytes-per-second value as a human-readable throughput string. Example: 2_097_152.0.bytesPerSecToHuman() → "2.0 MB/s"

Link copied to clipboard

Converts bytes per second to bits per second. Example: 1_000_000.0.bytesToBps() → 8_000_000.0

Link copied to clipboard
fun Long.centsToPrice(symbol: String = "$", thousandsSep: String = ","): String

Formats a Long amount in minor currency units (cents) as a price string. Example: 1999L.centsToPrice() → "$19.99"

Link copied to clipboard
fun Double.discountLabel(salePrice: Double, decimals: Int = 0): String

Returns a discount label string. Example: 100.0.discountLabel(80.0) → "-20%"

Link copied to clipboard

Rounds a price to the nearest multiple of precision. Example: 14.3.roundToNearest(0.99) → 13.86

Link copied to clipboard
fun Double.toCompactPrice(symbol: String = "$"): String

Formats a price with compact notation for large values. Example: 1_500_000.0.toCompactPrice() → "$1.5M"

Link copied to clipboard
fun Double.toPrice(symbol: String = "$", decimals: Int = 2, thousandsSep: String = ",", decimalSep: String = ".", symbolAfter: Boolean = false): String

Formats a Double as a price string with a currency symbol. Example: 19.99.toPrice() → "$19.99" Example: 1234.5.toPrice("€", thousandsSep = ".") → "€1.234,50"

Link copied to clipboard
fun Double.toPriceRange(max: Double, symbol: String = "$"): String

Formats a price range. Example: 9.99.toPriceRange(49.99) → "$9.99 – $49.99"

Link copied to clipboard
fun Double.transferTimeLabel(fileSizeBytes: Double): String

Formats an estimated transfer time from bandwidth (bps) and file size (bytes). Example: 1_000_000.0.transferTimeLabel(5_000_000.0) → "40s"

Link copied to clipboard

Estimates the transfer time in seconds for a given fileSizeBytes at this bandwidth (bps). Example: 10_000_000.0.transferTimeSeconds(100_000_000.0) → 0.8 seconds

Link copied to clipboard
fun Double.usagePercent(quota: Double, decimals: Int = 1): String

Formats a data usage percentage out of a quota. Example: 3_000_000_000.0.usagePercent(10_000_000_000.0) → "30.0%"

Link copied to clipboard

Returns the pre-tax price from a tax-inclusive price. Example: 120.0.withoutTax(0.20) → 100.0

Link copied to clipboard

Applies a VAT/tax rate to a price and returns the total. Example: 100.0.withTax(0.20) → 120.0