2025-07-31 20:12:24 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if NETFRAMEWORK
|
|
|
|
|
|
using System.Diagnostics.Contracts;
|
|
|
|
|
|
|
2026-01-02 17:30:41 +08:00
|
|
|
|
namespace Melskin.Extensions;
|
2025-07-31 20:12:24 +08:00
|
|
|
|
|
|
|
|
|
|
internal static class StringExtensions
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 使用指定的比较规则,返回指定字符串是否出现在此字符串中的值。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="source">源字符串。</param>
|
|
|
|
|
|
/// <param name="value">要查找的字符串。</param>
|
|
|
|
|
|
/// <param name="comparison">枚举值之一,用于指定比较中使用的规则。</param>
|
|
|
|
|
|
/// <returns>如果参数 value 出现在该字符串中,或 value 为空字符串 ("") 则为 true;否则为 false。</returns>
|
|
|
|
|
|
[Pure]
|
|
|
|
|
|
internal static bool Contains(this string source, string value, StringComparison comparison)
|
|
|
|
|
|
{ return source.IndexOf(value, comparison) >= 0; }
|
|
|
|
|
|
}
|
|
|
|
|
|
#endif
|