Clean up FirstCharacterToLower extension + tests

This commit is contained in:
Mark McDowall
2019-06-10 21:32:09 -07:00
committed by ta264
parent 91082b2903
commit 2ce0fadb65
4 changed files with 19 additions and 5 deletions
@@ -24,12 +24,22 @@ namespace NzbDrone.Common.Extensions
public static string FirstCharToLower(this string input)
{
return input.First().ToString().ToLower() + input.Substring(1);
if (string.IsNullOrEmpty(input))
{
return string.Empty;
}
return char.ToLowerInvariant(input.First()) + input.Substring(1);
}
public static string FirstCharToUpper(this string input)
{
return input.First().ToString().ToUpper() + input.Substring(1);
if (string.IsNullOrEmpty(input))
{
return string.Empty;
}
return char.ToUpperInvariant(input.First()) + input.Substring(1);
}
public static string Inject(this string format, params object[] formattingArgs)