Re: Basic Q: When is a string not a string?
Re: Basic Q: When is a string not a string?
- Subject: Re: Basic Q: When is a string not a string?
- From: Walter Ian Kaye <email@hidden>
- Date: Sat, 24 Jan 2004 12:59:27 -0800
At 02:23p -0600 01/24/2004, Chap Harrison didst inscribe upon an
electronic papyrus:
I'm just trying to search a list for a string and return its
position in the list. I can't find a simple verb in the docs, so I
coded a search.
The display-dialogs indicate that I'm comparing a string to a
string; yet the comparison doesn't work until I specify 'theListItem
as string'.
I just don't understand this language. Sure I have a workaround,
but I'd like to know what concept I'm unclear on here. Please help
a despairing lad ;-)
... when it's a reference to a string.
See, type class comparisons are exact. A string is a string, but a reference
to a string is a reference. A reference is not a string, thus no match.
The reference must first be de-referenced, and there are a variety of ways
to do that:
1. If you know it's a string, you can do 'theListItem as string'
2. If you do not know its type class, then one of the following:
a. 'theListItem as item'
b. 'contents of theListItem'
HTH,
-Walter
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.