endsWith Method

Class: String

Description

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

Syntax

StringObject.endsWith(String end,Boolean ignoreCase)

Parameters

end

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 ends with the specified string.

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

When Became Available

v7.0

Example

type String STR = "This is the End!"

 

type Boolean B1 = STR.endsWith("end!")    // 0 (wrong case)

type Boolean B2 = STR.endsWith("End!")    // 1

 

type Boolean B1 = STR.endsWith("end!",1)  // 1

type Boolean B2 = STR.endsWith("end",1)   // 0 no exclamation mark