format

fun Double.format(decimals: Int = -1, width: Int = -1): String

Formats a double to the desired number of decimals or characters.