Compartilhar via


StringAssert.StartsWith Method

Definition

Overloads

StartsWith(String, String, String, Object[])

Tests whether the specified string begins with the specified substring and throws an exception if the test string does not start with the substring.

StartsWith()

Tests whether the specified string begins with the specified substring and throws an exception if the test string does not start with the substring.

StartsWith(String, String)

Tests whether the specified string begins with the specified substring and throws an exception if the test string does not start with the substring.

StartsWith(String, String, String)

Tests whether the specified string begins with the specified substring and throws an exception if the test string does not start with the substring.

StartsWith(String, String, String, Object[])

Tests whether the specified string begins with the specified substring and throws an exception if the test string does not start with the substring.

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

Parameters

value
String

The string that is expected to begin with substring.

substring
String

The string expected to be a prefix of value.

message
String

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

parameters
Object[]

An array of parameters to use when formatting message.

Exceptions

Thrown if value does not begin with substring.

Applies to

StartsWith()

Tests whether the specified string begins with the specified substring and throws an exception if the test string does not start with the substring.

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

Exceptions

Thrown if value does not begin with substring.

Applies to

StartsWith(String, String)

Tests whether the specified string begins with the specified substring and throws an exception if the test string does not start with the substring.

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

Parameters

value
String

The string that is expected to begin with substring.

substring
String

The string expected to be a prefix of value.

Exceptions

Thrown if value does not begin with substring.

Applies to

StartsWith(String, String, String)

Tests whether the specified string begins with the specified substring and throws an exception if the test string does not start with the substring.

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

Parameters

value
String

The string that is expected to begin with substring.

substring
String

The string expected to be a prefix of value.

message
String

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

Exceptions

Thrown if value does not begin with substring.

Applies to