다음을 통해 공유


StringAssert.Contains Method

Definition

Overloads

Contains()

Tests whether the specified string contains the specified substring and throws an exception if the substring does not occur within the test string.

Contains(String, String)

Tests whether the specified string contains the specified substring and throws an exception if the substring does not occur within the test string.

Contains(String, String, String)

Tests whether the specified string contains the specified substring and throws an exception if the substring does not occur within the test string.

Contains(String, String, String, Object[])

Tests whether the specified string contains the specified substring and throws an exception if the substring does not occur within the test string.

Contains()

Tests whether the specified string contains the specified substring and throws an exception if the substring does not occur within the test string.

public:
 static void Contains(System::String ^ value, System::String ^ substring, System::String ^ message, StringComparison comparisonType, ... cli::array <System::Object ^> ^ parameters);
public static void Contains (string value, string substring, string message, StringComparison comparisonType, params object[] parameters);
static member Contains : string * string * string * StringComparison * obj[] -> unit
Public Shared Sub Contains (value As String, substring As String, message As String, comparisonType As StringComparison, ParamArray parameters As Object())

Exceptions

Thrown if substring is not found in value.

Applies to

Contains(String, String)

Tests whether the specified string contains the specified substring and throws an exception if the substring does not occur within the test string.

public:
 static void Contains(System::String ^ value, System::String ^ substring);
public static void Contains (string value, string substring);
static member Contains : string * string -> unit
Public Shared Sub Contains (value As String, substring As String)

Parameters

value
String

The string that is expected to contain substring.

substring
String

The string expected to occur within value.

Exceptions

Thrown if substring is not found in value.

Applies to

Contains(String, String, String)

Tests whether the specified string contains the specified substring and throws an exception if the substring does not occur within the test string.

public:
 static void Contains(System::String ^ value, System::String ^ substring, System::String ^ message);
public static void Contains (string value, string substring, string message);
static member Contains : string * string * string -> unit
Public Shared Sub Contains (value As String, substring As String, message As String)

Parameters

value
String

The string that is expected to contain substring.

substring
String

The string expected to occur within value.

message
String

The message to include in the exception when substring is not in value. The message is shown in test results.

Exceptions

Thrown if substring is not found in value.

Applies to

Contains(String, String, String, Object[])

Tests whether the specified string contains the specified substring and throws an exception if the substring does not occur within the test string.

public:
 static void Contains(System::String ^ value, System::String ^ substring, System::String ^ message, ... cli::array <System::Object ^> ^ parameters);
public static void Contains (string value, string substring, string message, params object[] parameters);
static member Contains : string * string * string * obj[] -> unit
Public Shared Sub Contains (value As String, substring As String, message As String, ParamArray parameters As Object())

Parameters

value
String

The string that is expected to contain substring.

substring
String

The string expected to occur within value.

message
String

The message to include in the exception when substring is not in value. The message is shown in test results.

parameters
Object[]

An array of parameters to use when formatting message.

Exceptions

Thrown if substring is not found in value.

Applies to