mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
String contains extension
This commit is contained in:
parent
5ad848b9c8
commit
42c8f3f22a
2 changed files with 7 additions and 2 deletions
|
@ -31,6 +31,11 @@ namespace ShareX.HelpersLib
|
||||||
{
|
{
|
||||||
public static class StringExtensions
|
public static class StringExtensions
|
||||||
{
|
{
|
||||||
|
public static bool Contains(this string str, string value, StringComparison comparisonType)
|
||||||
|
{
|
||||||
|
return str.IndexOf(value, comparisonType) >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
public static string Left(this string str, int length)
|
public static string Left(this string str, int length)
|
||||||
{
|
{
|
||||||
if (length < 1) return string.Empty;
|
if (length < 1) return string.Empty;
|
||||||
|
|
|
@ -124,7 +124,7 @@ private HistoryItem[] ApplyFilters(HistoryItem[] historyItems)
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(host))
|
if (!string.IsNullOrEmpty(host))
|
||||||
{
|
{
|
||||||
result = result.Where(x => !string.IsNullOrEmpty(x.Host) && x.Host.IndexOf(host, StringComparison.InvariantCultureIgnoreCase) >= 0);
|
result = result.Where(x => !string.IsNullOrEmpty(x.Host) && x.Host.Contains(host, StringComparison.InvariantCultureIgnoreCase));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ private HistoryItem[] ApplyFilters(HistoryItem[] historyItems)
|
||||||
|
|
||||||
if (cbFilenameFilterMethod.SelectedIndex == 0) // Contains
|
if (cbFilenameFilterMethod.SelectedIndex == 0) // Contains
|
||||||
{
|
{
|
||||||
result = result.Where(x => x.Filename.IndexOf(filenameFilter, rule) >= 0);
|
result = result.Where(x => x.Filename.Contains(filenameFilter, rule));
|
||||||
}
|
}
|
||||||
else if (cbFilenameFilterMethod.SelectedIndex == 1) // Starts with
|
else if (cbFilenameFilterMethod.SelectedIndex == 1) // Starts with
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue