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.
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
- RuntimeException when options are invalid (currently not 0 or 1).
- InvalidArgumentException when other is an empty text value.
Sample Code
Check the beginning characters of some text: