From a05312c9a26b3f2178779e6220aa4f82ffc65137 Mon Sep 17 00:00:00 2001
From: cdwcgt <loginchen@outlook.com>
Date: Sat, 27 May 2023 23:44:50 +0900
Subject: [PATCH] simplify format method
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Co-authored-by: Bartłomiej Dach <dach.bartlomiej@gmail.com>
---
 osu.Game/Graphics/UserInterface/OsuSliderBar.cs | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs
index 688a8ce8e6..e5f5f97eb7 100644
--- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs
+++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs
@@ -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;