Re: Don't test s="" [was Re: Strange string test error]
Re: Don't test s="" [was Re: Strange string test error]
- Subject: Re: Don't test s="" [was Re: Strange string test error]
- From: Paul Berkowitz <email@hidden>
- Date: Thu, 12 Dec 2002 12:30:33 -0800
On 12/12/02 12:21 PM, I wrote:
>
On 12/12/02 11:56 AM, "Emmanuel" <email@hidden> wrote:
>
>
> I just restate the conclusion of the latest posts, so that it be
>
> clear for as many people as possible:
>
>
>
> Do not test for an empty string:
>
>
>
> ----------------------
>
> if (s = "") -- don't do that
>
> ----------------------
>
>
>
> unless you know for sure that s is a shorter string than 32K.
>
>
>
> Instead, test for a null length, it's safer.
>
>
>
> ----------------------
>
> if (s's length = 0) -- do that instead
>
> ----------------------
>
>
>
I've forgotten about 'contains': can you search for a substring in a
>
string that's longer than 32K?
You can't: it gives a false negative (not an error), even if the substring
is near the beginning. Yucch.
--
Paul Berkowitz
_______________________________________________
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.