Team LiB   Previous Section   Next Section
ends with

Syntax

"index.html" ends with ".html" -- returns true

Return value

boolean; true or false

Description

This operator is invaluable when searching a disk or folder for files with certain file extensions (e.g., .html, .gif ) and then doing something only with those found files. The ends with operator works with lists and strings. If you use this operator to compare a string with a list or vice versa, then AppleScript tries to coerce the string or list to the type of the left operand.

Examples

{"apples", "oranges"} ends with "oranges" -- returns true



"oranges" ends with {"n","g","e","s"} (* true, after AppleScript coerces the 

right operand from list to string, after which it looks like "nges" *)



{"img1.gif", "img2.gif"} ends with ".gif" -- false 



{"img1.gif", "img2.gif"} ends with "img2.gif" -- true
    Team LiB   Previous Section   Next Section