• 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
You want crazy? I got crazy.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

You want crazy? I got crazy.


  • Subject: You want crazy? I got crazy.
  • From: Rob Lewis <email@hidden>
  • Date: Wed, 12 Dec 2007 14:11:58 -0800

I was trying to create a very simple parsing routine.

The input is a string consisting of words and phrases separated by commas. I converted it into a list by changing the text item delimiters to "," and then getting "text items of" the string.

To test the routine, I tried strings that contained two commas in a row. These were correctly (it seems to me) returned as list elements consisting of empty strings.

Then I took each list element (a string) and passed it to a routine that trimmed leading and trailing spaces. Only it kept giving errors. By inserting "display dialog" statements everywhere, I determined that:

--one of these empty strings from the list, which originally reported a length of 0, now reported a length of 1 after being passed to the trim routine.

--this spurious character had an ASCII number value of 32 (a space)

--this spurious character did NOT match the AppleScript string " " (i.e., a single space).

So: an empty string somehow got converted to a 1-character string, and that string does not equal an AppleScript space, even though its numeric value is that of a space character! WTF?

It occurred to me that this could have something to do with Unicode text, or something, but I'm using Tiger, which doesn't have that issue, right?

I rewrote the parser using an entirely different technique and it seems to work, but really, what's going on here? _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users


This email sent to email@hidden
  • Follow-Ups:
    • Re: You want crazy? I got crazy.
      • From: Skeeve <email@hidden>
  • Prev by Date: Has Apple updated the Applescript Language Guide yet?
  • Next by Date: Re: Application responses, Timeouts, Try statements, Activate - how do they really work?
  • Previous by thread: Has Apple updated the Applescript Language Guide yet?
  • Next by thread: Re: You want crazy? I got crazy.
  • Index(es):
    • Date
    • Thread