Name

offset

Synopsis

substring position

substring position

Reports the position of a substring within a target string. Character position values start at 1. Returns 0 if the substring isn't found. Formerly considered case and ignored diacriticals, which is backwards from AppleScript's own defaults; staring in Panther, this is fixed, and string considerations are obeyed (see "String Considerations" in Chapter 19).

Example

offset of "bb" in "Ribbit" -- 3

Get AppleScript: The Definitive Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.