Skip to content

Commit

Permalink
Add StringUtils.Contains() extension method with StringComparer
Browse files Browse the repository at this point in the history
  • Loading branch information
RickStrahl committed Sep 7, 2018
1 parent 70c588d commit ccf70e4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions Westwind.Utilities/Utilities/StringUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,19 @@ public static bool Inlist(string s, params string[] list)
return list.Contains(s);
}


/// <summary>
/// String.Contains() extension method that allows to specify case
/// </summary>
/// <param name="text">Input text</param>
/// <param name="searchFor">text to search for</param>
/// <param name="stringComparison">Case sensitivity options</param>
/// <returns></returns>
public static bool Contains(this string text, string searchFor, StringComparison stringComparison)
{
return text.IndexOf(searchFor, stringComparison) > -1;
}

/// <summary>
/// Parses a string into an array of lines broken
/// by \r\n or \n
Expand Down
2 changes: 1 addition & 1 deletion Westwind.Utilities/Westwind.Utilities.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net45;net40</TargetFrameworks>
<Version>3.0.20</Version>
<Version>3.0.20.1</Version>
<RuntimeIdentifiers>win7-x86;win7-x64</RuntimeIdentifiers>
<Authors>Rick Strahl</Authors>
<RequireLicenseAcceptance>false</RequireLicenseAcceptance>
Expand Down

0 comments on commit ccf70e4

Please sign in to comment.