mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 14:12:56 +08:00
simplify format method
Co-authored-by: Bartłomiej Dach <dach.bartlomiej@gmail.com>
This commit is contained in:
parent
89c8ef3c9b
commit
a05312c9a2
@ -96,11 +96,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
if (DisplayAsPercentage)
|
||||
{
|
||||
if (significantDigits <= 2)
|
||||
return floatValue.ToString("0%");
|
||||
|
||||
string format = "0." + new string('0', significantDigits - 2) + "%";
|
||||
return floatValue.ToString(format);
|
||||
return floatValue.ToString($@"P{Math.Max(0, significantDigits - 2)}");
|
||||
}
|
||||
|
||||
string negativeSign = Math.Round(floatValue, significantDigits) < 0 ? "-" : string.Empty;
|
||||
|
Loading…
Reference in New Issue
Block a user