• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Why won't this parse?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why won't this parse?


  • Subject: Re: Why won't this parse?
  • From: Paul Berkowitz <email@hidden>
  • Date: Thu, 10 May 2001 10:32:52 -0700

On 5/10/01 9:51 AM, "David Graham" <email@hidden> wrote:

>>> set AppleScript's text item delimiters to ASCII number 32 -- space
>>
>> ASCII number 32 is not space. It's
>>
>> 51
>
> Hmm...
>
> Then why do I get this?
>
> ASCII number of " "
> -- 32

Because that's correct.

ASCII number of " " = 32
ASCII character 32 = " "
ASCII number of "3" = 51
ASCII character 51 = "3"

I didn't do it right the last time. Sorry. You can only have ASCII numbers
of single-character strings - individual characters including individual
digits as string. AppleScript will coerce a single digit (3) to its string
equivalent ("3") to come up with the ASCII number of it (51). It appears
that it will also coerce a multi-character string to its first character and
get you the ASCII number, rather than error.

So:

ASCII number "a" = 97
ASCII number "abc" = 97
ASCII number "3" = 51
ASDCII number "32" = 51
ASCII number "325678888997" = 51
ASCII number 3 [coerced to "3"] = 51
ASCII number 32 [coerced to "32"] = 51
ASCII number "325678888997" = 51

The last five are all coerced to

ASCII number "3"

which is the same as

ASCII number of "3"

But you don't want ASCII number of anything. You want the character " ".

That's

ASCII character 32 = " "

Since you wrote 'number' instead of 'character' you got

ASCII number of 32 = ASCII number "3" = 51

and the rest of your script errored, since using {51} as AppleScript's text
item delimiters in a string containing no substring "51" is going to give
you only one text item (the whole string).

--
Paul Berkowitz


  • Follow-Ups:
    • Re: Why won't this parse?
      • From: David Graham <email@hidden>
References: 
 >Re: Why won't this parse? (From: David Graham <email@hidden>)

  • Prev by Date: Re: Can't run RegEx --Conflict??
  • Next by Date: Re: Writing large scripts
  • Previous by thread: Re: Why won't this parse?
  • Next by thread: Re: Why won't this parse?
  • Index(es):
    • Date
    • Thread