beginsWith Method

Class: String

Description

This method determines if a string begins with a specified string. For example, it will determine if the phrase "Be free, fly far away" begins with "Be ".

Syntax

StringObject.beginsWith(String begin,Boolean ignoreCase)

Parameters

begin

The string to look for.

ignoreCase

An option that indicates whether to ignore case. Valid values are 1 (ignore case) and 0 (do not ignore case). If not specified, the default is 0.

Returns

True, if the string begins with the specified string.

False, if the string does not begin with the specified string.

When Became Available

v7.0

Example

type String STR = "There we go again ..."

 

type Boolean B1 = STR.beginsWith("there")   // 0 (wrong case)

type Boolean B2 = STR.beginsWith("The")     // 1

 

type Boolean B1 = STR.beginsWith("there",1) // 1

type Boolean B2 = STR.beginsWith("The",1)   // 1