mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
FirstCharToLower
This commit is contained in:
parent
77d02a03a0
commit
b8b8f064c7
4 changed files with 44 additions and 1 deletions
|
@ -0,0 +1,18 @@
|
||||||
|
using FluentAssertions;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Common.Extensions;
|
||||||
|
|
||||||
|
namespace NzbDrone.Common.Test.ExtensionTests.StringExtensionTests
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class FirstCharcacterToLowerFixture
|
||||||
|
{
|
||||||
|
[TestCase("Hello", "hello")]
|
||||||
|
[TestCase("CamelCase", "camelCase")]
|
||||||
|
[TestCase("A Full Sentence", "a Full Sentence")]
|
||||||
|
public void should_lower_case_first_character(string input, string expected)
|
||||||
|
{
|
||||||
|
input.FirstCharToLower().Should().Be(expected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
using FluentAssertions;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using NzbDrone.Common.Extensions;
|
||||||
|
|
||||||
|
namespace NzbDrone.Common.Test.ExtensionTests.StringExtensionTests
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class FirstCharcacterToUpperFixture
|
||||||
|
{
|
||||||
|
[TestCase("hello", "Hello")]
|
||||||
|
[TestCase("camelCase", "CamelCase")]
|
||||||
|
[TestCase("a full sentence", "A full sentence")]
|
||||||
|
public void should_capitalize_first_character(string input, string expected)
|
||||||
|
{
|
||||||
|
input.FirstCharToUpper().Should().Be(expected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -70,6 +70,8 @@
|
||||||
<Compile Include="ExtensionTests\IEnumerableExtensionTests\ExceptByFixture.cs" />
|
<Compile Include="ExtensionTests\IEnumerableExtensionTests\ExceptByFixture.cs" />
|
||||||
<Compile Include="ExtensionTests\IEnumerableExtensionTests\IntersectByFixture.cs" />
|
<Compile Include="ExtensionTests\IEnumerableExtensionTests\IntersectByFixture.cs" />
|
||||||
<Compile Include="ExtensionTests\Int64ExtensionFixture.cs" />
|
<Compile Include="ExtensionTests\Int64ExtensionFixture.cs" />
|
||||||
|
<Compile Include="ExtensionTests\StringExtensionTests\FirstCharcacterToLowerFixture.cs" />
|
||||||
|
<Compile Include="ExtensionTests\StringExtensionTests\FirstCharcacterToUpperFixture.cs" />
|
||||||
<Compile Include="ExtensionTests\UrlExtensionsFixture.cs" />
|
<Compile Include="ExtensionTests\UrlExtensionsFixture.cs" />
|
||||||
<Compile Include="ExtensionTests\FuzzyContainsFixture.cs" />
|
<Compile Include="ExtensionTests\FuzzyContainsFixture.cs" />
|
||||||
<Compile Include="HashUtilFixture.cs" />
|
<Compile Include="HashUtilFixture.cs" />
|
||||||
|
|
|
@ -22,9 +22,14 @@ namespace NzbDrone.Common.Extensions
|
||||||
return "[NULL]";
|
return "[NULL]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string FirstCharToLower(this string input)
|
||||||
|
{
|
||||||
|
return input.First().ToString().ToLower() + input.Substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
public static string FirstCharToUpper(this string input)
|
public static string FirstCharToUpper(this string input)
|
||||||
{
|
{
|
||||||
return input.First().ToString().ToUpper() + string.Join("", input.Skip(1));
|
return input.First().ToString().ToUpper() + input.Substring(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string Inject(this string format, params object[] formattingArgs)
|
public static string Inject(this string format, params object[] formattingArgs)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue