Skip to content

Commit 546110a

Browse files
committed
Add ContainsIgnoreCase
1 parent 78d683e commit 546110a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/StructuredLogger/TextUtilities.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,16 @@ public static bool Contains(this string text, Span span, char ch)
209209
return IndexOf(text, span, ch) != -1;
210210
}
211211

212+
public static bool ContainsIgnoreCase(this string text, string substring)
213+
{
214+
if (text == null || substring == null)
215+
{
216+
return false;
217+
}
218+
219+
return text.IndexOf(substring, StringComparison.OrdinalIgnoreCase) != -1;
220+
}
221+
212222
public static int IndexOf(this string text, Span span, char ch)
213223
{
214224
#if NET

0 commit comments

Comments
 (0)