C# String StartsWith(String)
Description
String StartsWith(String)
determines whether the beginning
of this string instance matches the specified string.
Syntax
String.StartsWith(String)
has the following syntax.
public bool StartsWith(
string value
)
Parameters
String.StartsWith(String)
has the following parameters.
value
- The string to compare.
Returns
String.StartsWith(String)
method returns true if value matches the beginning of this string; otherwise, false.
Example
The following example demonstrates how you can use the StartsWith method.
using System;/* ww w . ja v a 2s . c o m*/
public class EndsWithTest {
public static void Main() {
Console.WriteLine("java2s.com".StartsWith("java"));
}
}
The code above generates the following result.