Re: text vs string
Re: text vs string
- Subject: Re: text vs string
- From: Michael Turner <email@hidden>
- Date: Tue, 06 Feb 2001 11:16:03 -0500
Thanks Nigel, but,
My head hurts.
:-0
Ok, so there is a finer distinction.
-Michael
>
From: Nigel Garvey <email@hidden>
>
Subject: Re: text vs string
>
>
Michael Turner wrote on Mon, 05 Feb 2001 14:05:20 -0500:
>
>
> I have noticed several examples of scripts with the data type "text" where I
>
> would naturally have used "string". What is the difference between these
>
> data types? I suspect that some of my frustration with strings in
>
> AppleScript comes from utilizing them when I should be using data type
>
> "text"
>
>
Just to qualify Jeff's and Pier's responses to this, if I may: the terms
>
are synonymous *in respect of coercions performed by AppleScript*. I know
>
of one OSAX command ('the clipboard') where 'as string' is a parameter of
>
the command itself, not a coercion performed on the result. It returns
>
unstyled text if the clipboard contains text or a number. If you use 'as
>
text' instead, the result is an empty list. (The 'path to' command, on
>
the other hand, works equally well with either 'as string' or 'as text'
>
as its parameter.)
>
>
The 'text' class in a range (as opposed to a coercion) seems to be
>
synonymous with the plural expression 'strings'.
>
>
text 1 thru 8 of "Now here's a funny thing."
>
--> "Now here"
>
>
strings 1 thru 8 of "Now here's a funny thing."
>
--> "Now here"
>
>
text 1 thru 3 of {"Now", "here's", "a", "funny", "thing."}
>
--> {"Now", "here's", "a"}
>
>
strings 1 thru 3 of {"Now", "here's", "a", "funny", "thing."}
>
--> {"Now", "here's", "a"}
>
>
NG