• 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: A problem with signs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A problem with signs


  • Subject: Re: A problem with signs
  • From: Christopher Nebel <email@hidden>
  • Date: Tue, 23 May 2006 12:11:36 -0700


On May 22, 2006, at 9:35 PM, Carl Anderson wrote:

I am trying to write an Applescript but am having a problem with "-" signs.
This is a sample program that contains the problem


	set x to "-0.1234"
	set y to first word of x
	display dialog x & " " & y

The program returns -0.1234 for x but returns a (+)0.1234 for y. I have asked for the first character of x only to get a "0" instead of a "-".

(I'm going to assume that "first character of x" was a typo, and you meant "first character of y", because otherwise something is really weird.)


A "word" in AppleScript is not simply a sequence of non-whitespace characters -- it's defined by the local word-break rules, as set in the International preference pane. Depending on the locale you use, a leading hyphen may or may not be considered part of the "word". If what you want is simply non-whitespace, use a different method. "text items" may be of some use.


--Chris Nebel AppleScript and Automator Engineering

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >A problem with signs (From: Carl Anderson <email@hidden>)

  • Prev by Date: Re: To shell or not to shell (was Re: URL Access Redux)
  • Next by Date: RE: To shell or not to shell (was Re: URL Access Redux)
  • Previous by thread: Re: A problem with signs
  • Next by thread: Moving selected messages from one entourage folder to another
  • Index(es):
    • Date
    • Thread