From 1c4dedd4f48a35b13363c280ccf10527b49724a4 Mon Sep 17 00:00:00 2001 From: sharinganthief Date: Thu, 30 Apr 2026 10:53:38 -0400 Subject: [PATCH] local changes --- .../Extensions/StringExtensions.cs | 23 +++++++++++++++---- src/NzbDrone.Core/Lidarr.Core.csproj | 2 +- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/NzbDrone.Common/Extensions/StringExtensions.cs b/src/NzbDrone.Common/Extensions/StringExtensions.cs index ae5e43bbf..0b799984c 100644 --- a/src/NzbDrone.Common/Extensions/StringExtensions.cs +++ b/src/NzbDrone.Common/Extensions/StringExtensions.cs @@ -30,22 +30,37 @@ public static object NullSafe(this object target) public static string FirstCharToLower(this string input) { - if (string.IsNullOrEmpty(input)) + var firstChar = GetFirstCharOrHash(input); + + if (string.IsNullOrEmpty(firstChar)) { return string.Empty; } - return char.ToLowerInvariant(input.First()) + input.Substring(1); + return string.Concat(firstChar.ToLowerInvariant(), input.AsSpan(1)); } - public static string FirstCharToUpper(this string input) + public static string GetFirstCharOrHash(string input) { if (string.IsNullOrEmpty(input)) { return string.Empty; } - return char.ToUpperInvariant(input.First()) + input.Substring(1); + var firstChar = input[0]; + return char.IsDigit(firstChar) ? "#" : firstChar.ToString(); + } + + public static string FirstCharToUpper(this string input) + { + var firstChar = GetFirstCharOrHash(input); + + if (string.IsNullOrEmpty(firstChar)) + { + return string.Empty; + } + + return string.Concat(firstChar.ToUpperInvariant(), input.AsSpan(1)); } public static string Inject(this string format, params object[] formattingArgs) diff --git a/src/NzbDrone.Core/Lidarr.Core.csproj b/src/NzbDrone.Core/Lidarr.Core.csproj index ad9cce669..5cd807625 100644 --- a/src/NzbDrone.Core/Lidarr.Core.csproj +++ b/src/NzbDrone.Core/Lidarr.Core.csproj @@ -6,7 +6,7 @@ - +