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 @@
-
+