DekGenius.com
Team LiB   Previous Section   Next Section
text

Allowed coercions

list with one item; numbers as long as the string is a valid integer or real

Syntax

set myString to "text is just a string" as text

Description

text is a straightforward synonym for string, with no differences (see the string data type). Make sure not to mistake the text class for the string class's text element (you can get text 1 thru 10 of a string to return the first 10 characters as a string). This AppleScript shows how you can store strings as text, but its class remains string:

set myString to "text is just a string" as text
set len to length of myString -- text has the same properties as string
log len -- find out the string length in Event Log
class of myString -- returns string
    Team LiB   Previous Section   Next Section