String.BeginsWith

From Xojo Documentation

Method

Returns True if the string begins with the value passed.

Syntax

result=stringVariable.BeginsWith(value As String, options As ComparisonOptions = ComparisonOptions.CaseInsensitive, locale as Locale = Nil)

Part Type Description
result Boolean True if the stringVariable begins with the value passed.
stringVariable String Any variable of type String.
value String The String you are looking for.
options ComparisonOptions Determines if the comparison is case-sensitive or not.
locale Locale If provided, the locale is considered.

Notes

BeginsWith tells you whether or not the source string begins with the value passed based upon the comparison option (case-sensitive or case-insensitive) and locale specified.

Examples

This example uses the BeginsWith function determine if the source string begins with "Inc.":

Var s As String
s = "Xojo, Inc."
If s.BeginsWith("Xojo", ComparisonOptions.CaseSensitive, Locale.Current) then
System.Beep
Msgbox("It begins with Xojo.")
End If

See Also

String for a complete list of functions.