beginsWith

Syntax expression1 beginsWith expression2

Action Evaluates both expressions as strings, and determines whether the result of expression1 begins with the result of expression2. If expression1 produces a list, expression2 is evaluated as a list and the comparison is done on a list basis rather than as

strings.

Examples "The quick brown fox" beginsWith "The"

   » true

string.lower (file.fileFromPath (f)) beginsWith "temp"

   » true

The expression would return true for files named "tempfile", "Temporary Data", "temp", etc.

1234 beginsWith 12

   » true

The numbers are converted to strings for this operation.

{1, 2, 3} beginsWith {1, 2}

   » true

This is an example of applying the beginsWith operator to a list.

{1, 2, 3} beginsWith 1

   » true

The number 1 is converted to a list for this comparison.

Notes The beginsWith operator is case-sensitive; upper-case characters do not match lower-case ones.

See Also contains

endsWith

string.patternMatch

Discuss