mirror of
https://github.com/chylex/Minecraft-Phantom-Panel.git
synced 2024-11-22 08:42:44 +01:00
13 lines
438 B
C#
13 lines
438 B
C#
using System.Text.RegularExpressions;
|
|
|
|
namespace Phantom.Server.Web.Utils;
|
|
|
|
static partial class EnumNameConverter {
|
|
[GeneratedRegex(@"\B([A-Z])", RegexOptions.NonBacktracking)]
|
|
private static partial Regex FindCapitalLettersRegex();
|
|
|
|
public static string ToNiceString<T>(this T type) where T : Enum {
|
|
return FindCapitalLettersRegex().Replace(type.ToString(), static match => " " + match.Groups[1].Value.ToLowerInvariant());
|
|
}
|
|
}
|