mirror of
https://github.com/Tribufu/ServerManagers
synced 2026-08-08 12:11:05 +00:00
17 lines
666 B
C#
17 lines
666 B
C#
using System;
|
|
|
|
namespace ServerManagerTool.Common.Extensions
|
|
{
|
|
public static class StringExtensions
|
|
{
|
|
public static bool Contains(this string value, string substring, StringComparison comparisonType)
|
|
{
|
|
if (substring == null)
|
|
throw new ArgumentNullException(nameof(substring), $"{nameof(substring)} cannot be null.");
|
|
if (!Enum.IsDefined(typeof(StringComparison), comparisonType))
|
|
throw new ArgumentException($"{nameof(comparisonType)} is not a member of StringComparison", nameof(comparisonType));
|
|
|
|
return value.IndexOf(substring, comparisonType) >= 0;
|
|
}
|
|
}
|
|
}
|