1
0
mirror of https://github.com/chylex/Minecraft-Phantom-Panel.git synced 2024-10-17 03:42:50 +02:00
Minecraft-Phantom-Panel/Web/Phantom.Web/Utils/EnumNameConverter.cs

13 lines
431 B
C#

using System.Text.RegularExpressions;
namespace Phantom.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());
}
}