Determines whether the specified source string starts with the specified prefix using the specified System.Globalization.CompareOptions value.
- source
- The string to search in.
- prefix
- The string to compare with the beginning of source.
- options
- A value that defines how source and prefix should be compared. options is either the enumeration value CompareOptions.Ordinal, or a bitwise combination of one or more of the following values: CompareOptions.IgnoreCase, CompareOptions.IgnoreSymbols, CompareOptions.IgnoreNonSpace, CompareOptions.IgnoreWidth, and CompareOptions.IgnoreKanaType.
true if the length of prefix is less than or equal to the length of source and source starts with prefix; otherwise, false.
Every string starts and ends with an empty substring (""); therefore, if prefix is an empty string, this method returns true.
The CompareOptions.StringSort value is not valid for this method.
When possible, you should call string comparison methods that have a parameter of type System.Globalization.CompareOptions to specify the kind of comparison expected. As a general rule, use linguistic options (using the current culture) for comparing strings displayed in the user interface and specify CompareOptions.Ordinal or CompareOptions.OrdinalIgnoreCase for security comparisons.