StartsWith Method (String, Boolean, CultureInfo)

String.StartsWith Method (String, Boolean, CultureInfo)

Note: This method is new in the .NET Framework version 2.0.

Determines whether the beginning of this string matches the specified string when compared using the specified culture.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

public bool StartsWith (
	string value,
	bool ignoreCase,
	CultureInfo culture
public boolean StartsWith (
	String value, 
	boolean ignoreCase, 
	CultureInfo culture
public function StartsWith (
	value : String, 
	ignoreCase : boolean, 
	culture : CultureInfo
) : boolean



The String object to compare.


true to ignore case when comparing this string and value; otherwise, false.


Cultural information that determines how this string and value are compared. If culture is a null reference (Nothing in Visual Basic), the current culture is used.

Return Value

true if the value parameter matches the beginning of this string; otherwise, false.

Exception typeCondition


value is a null reference (Nothing in Visual Basic).

This method compares the value parameter to the substring at the beginning of this string that is the same length as value, and returns a value that indicates whether they are equal. To be equal, value must be an empty string (Empty), a reference to this same instance, or match the beginning of this instance.

This method performs a word (culture-sensitive) comparison using the specified casing and culture.

The following code example determines whether a string occurs at the beginning of another string. The StartsWith method is called several times using case sensitivity, case insensitivity, and different cultures that influence the results of the search.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

© 2015 Microsoft