Text.BeginsWith

From Xojo Documentation

Method

Text.BeginsWith(other As Text, options As Integer = 0, Optional locale As Xojo.Core.Locale = Nil) As Boolean

Supported for all project types and targets.

Determines whether the beginning of this Text instance matches the other text when compared using the specified comparison options and locale. Returns True if other matches the beginning of the text, False if it does not.

Parameters

Parameter Description
other This text is matched with the beginning of the text.
options (Optional) Use CompareCaseSensitive constant to have case-sensitive comparisons.
locale (Optional) Used to specify a Xojo.Core.Locale to use for the comparison.

Notes

By default this performs a case-insensitive comparison. To do a case-sensitive comparison, supply the CompareCaseSensitive constant to the options parameter.

By default comparisons are done in an invariant locale (i.e. not dependent on the user's preferences). The locale parameter can be used to specify an explicit locale to do comparisons in.

Exceptions

Sample Code

Check the beginning characters of some text:

Dim t As Text
t = "All we have to decide is what to do with the time that is given to us."

If t.BeginsWith("All") Then
Label1.Text = "Text starts with 'All'."
End If