format

fun Double.format(digits: Int): String

Formats the Double to a string with a specified number of decimal digits, using a period (.) as the decimal separator. Example: 3.14159.format(2) -> "3.14"


fun Float.format(digits: Int): String

Formats the Float to a string with a specified number of decimal digits, using a period (.) as the decimal separator. Example: 3.14159f.format(2) -> "3.14"