コード例 #1
0
 ///<summary>
 /// Checks if the specified string contains the specified substring, using the specified comparison type.
 ///</summary>
 ///<param name="s">The string in which to seek a substring.</param>
 ///<param name="subString">The string to seek.</param>
 ///<param name="comparisonType">The type of comparison to use.</param>
 ///<exception cref="ArgumentNullException">s or subString is null.</exception>
 ///<exception cref="ArgumentOutOfRangeException">comparisonType is not a valid StringComparison value.</exception>
 ///<returns>true si <c>s</c> contains <c>subString</c>, or if <c>subString</c> is an empty string; otherwise, false.</returns>
 public static bool Contains([NotNull] this string s, string subString, StringComparison comparisonType)
 {
     s.CheckArgumentNull(nameof(s));
     subString.CheckArgumentNull(nameof(subString));
     comparisonType.CheckArgumentInEnum(nameof(comparisonType));
     return(s.IndexOf(subString, comparisonType) >= 0);
 }