示例#1
0
        public static bool IsContaining(this string @string, string text, IgnoreCaseInfo ignoreCase = default)
        {
            @string.MustNotBeNull(nameof(@string));
            text.MustNotBeNull(nameof(text));

            return(ignoreCase.StringContains(@string, text));
        }
        public static string OldMustNotContain(this string parameter, string text, IgnoreCaseInfo ignoreCase = default, string parameterName = null, string message = null, Func <Exception> exception = null)
        {
            parameter.MustNotBeNull(parameterName);
            text.MustNotBeNull(nameof(text));

            if (parameter.IsContaining(text, ignoreCase) == false)
            {
                return(parameter);
            }

            throw exception?.Invoke() ?? new StringException(message ?? $"\"{parameter}\" must not contain \"{text}\", but it does.", parameterName);
        }
示例#3
0
        public static string OldMustBeSubstringOf(this string parameter, string text, IgnoreCaseInfo ignoreCase = default, string parameterName = null, string message = null, Func <Exception> exception = null)
        {
            parameter.MustNotBeNull(parameterName);
            text.MustNotBeNull(nameof(text));

            if (text.IsContaining(parameter, ignoreCase))
            {
                return(parameter);
            }

            throw exception?.Invoke() ?? new StringException(message ?? $"\"{parameter}\" must be a substring of \"{text}\", but it is not.", parameterName);
        }