コード例 #1
0
        internal static RegexOptions ConvertToRegexOptions(StringComparison comparisonType)
        {
            RegexOptions result = RegexOptions.None;

            if (comparisonType.HasFlag(StringComparison.InvariantCulture))
            {
                result |= RegexOptions.CultureInvariant;
            }
            if (comparisonType.HasFlag(StringComparison.CurrentCultureIgnoreCase) ||
                comparisonType.HasFlag(StringComparison.InvariantCultureIgnoreCase) ||
                comparisonType.HasFlag(StringComparison.OrdinalIgnoreCase))
            {
                result |= RegexOptions.IgnoreCase;
            }
            return(result);
        }
コード例 #2
0
 public static bool IsIgnoreCase(this StringComparison stringComparison)
 {
     return(ignoreCases.HasFlag(stringComparison));
 }