toPercent

inline fun <T : Number> T?.toPercent(locale: Locale = Locale.getDefault()): String

Formats this number as a percentage and returns the result as a string.

This number is interpreted as a decimal value, and the resulting string is formatted according to the locale's default rules for percentages. If this number is null, the result is an empty string.

Return

the formatted string.

Parameters

locale

the locale to which the percentage should be formatted.