mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Extract shared rank-formatting helper
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using Humanizer;
|
||||
|
||||
namespace osu.Game.Utils
|
||||
{
|
||||
public static class FormatUtils
|
||||
@ -18,5 +20,11 @@ namespace osu.Game.Utils
|
||||
/// <param name="accuracy">The accuracy to be formatted</param>
|
||||
/// <returns>formatted accuracy in percentage</returns>
|
||||
public static string FormatAccuracy(this decimal accuracy) => $"{accuracy:0.00}%";
|
||||
|
||||
/// <summary>
|
||||
/// Formats the supplied rank/leaderboard position in a consistent, simplified way.
|
||||
/// </summary>
|
||||
/// <param name="rank">The rank/position to be formatted.</param>
|
||||
public static string FormatRank(this int rank) => rank.ToMetric(decimals: rank < 100_000 ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user