Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/Z.Core/System.String/String.EqualsIgnoreCase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Description: C# Extension Methods Library to enhances the .NET Framework by adding hundreds of new methods. It drastically increases developers productivity and code readability. Support C# and VB.NET
// Website & Documentation: https://github.com/zzzprojects/Z.ExtensionMethods
// Forum: https://github.com/zzzprojects/Z.ExtensionMethods/issues
// License: https://github.com/zzzprojects/Z.ExtensionMethods/blob/master/LICENSE
// More projects: http://www.zzzprojects.com/
// Copyright � ZZZ Projects Inc. 2014 - 2016. All rights reserved.
using System;

public static partial class Extensions
{
/// <summary>
/// A string extension method that checks if '@this' is equal to another string regardless of it's case.
/// </summary>
/// <param name="this">The @this to act on.</param>
/// <param name="comparedString">The compared string.</param>
/// <returns>
/// true if it contains all values, otherwise false.
/// </returns>
public static bool EqualsIgnoreCase(this string @this, string comparedString)
{
return @this.Equals(comparedString, StringComparison.OrdinalIgnoreCase);
}
}
1 change: 1 addition & 0 deletions src/Z.Core/Z.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@
<Compile Include="System.Single\_CoreObject\Single.In.cs" />
<Compile Include="System.Single\_CoreObject\Single.InRange.cs" />
<Compile Include="System.Single\_CoreObject\Single.NotIn.cs" />
<Compile Include="System.String\String.EqualsIgnoreCase.cs" />
<Compile Include="System.String\String.ToValidDateTimeOrNull.cs" />
<Compile Include="System.String\String.Br2Nl.cs" />
<Compile Include="System.String\String.IsPalindrome.cs" />
Expand Down
29 changes: 29 additions & 0 deletions test/Z.Core.Test/System.String/String.EqualsIgnoreCase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Description: C# Extension Methods Library to enhances the .NET Framework by adding hundreds of new methods. It drastically increases developers productivity and code readability. Support C# and VB.NET
// Website & Documentation: https://github.com/zzzprojects/Z.ExtensionMethods
// Forum: https://github.com/zzzprojects/Z.ExtensionMethods/issues
// License: https://github.com/zzzprojects/Z.ExtensionMethods/blob/master/LICENSE
// More projects: http://www.zzzprojects.com/
// Copyright � ZZZ Projects Inc. 2014 - 2016. All rights reserved.
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Z.Core.Test
{
[TestClass]
public class System_String_EqualsIgnoreCase
{
[TestMethod]
public void EqualsIgnoreCase()
{
// Type
string @this = "FizBuzz";

// Examples
bool value1 = @this.EqualsIgnoreCase("fizbuzz"); // return true;
bool value2 = @this.EqualsIgnoreCase("FooBar"); // return false;

// Unit Test
Assert.IsTrue(value1);
Assert.IsFalse(value2);
}
}
}
1 change: 1 addition & 0 deletions test/Z.Core.Test/Z.Core.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="System.Object\Object.Try.cs" />
<Compile Include="System.String\String.EqualsIgnoreCase.cs" />
<Compile Include="System.String\String.IsValidEmail.cs" />
<Compile Include="System.String\String.IsPalindrome.cs" />
<Compile Include="System.String\String.IsAnagram.cs" />
Expand Down