Re: Changed definition of word? No dashes?
Re: Changed definition of word? No dashes?
- Subject: Re: Changed definition of word? No dashes?
- From: Chris Nebel <email@hidden>
- Date: Fri, 09 Feb 2001 18:24:10 -0800
- Organization: Apple Computer, Inc.
Harald E Brandt wrote:
>
Thanks a lot for the hint!
>
It seems like something along this is what I will have to do.
>
More elegant, however, would be the ability so set delimiters for words.
>
The problem with the proposal above is that I must know exactly the number of spaces (which can vary). I would like to set a delimiter of white space.
>
>
I *really* need to get the hyphen, since it is a script capturing account info from my internet bank, and I then use those "words" to add upp my account holding, so you can imagine the chock I got when all of a sudden, no negative values were subtracted, resulting in my account showing severe negative net holding!
The basic problem here is that AppleScript itself doesn't have any idea what composes a word and what doesn't -- it just asks the system Text Utilities to figure it out. That means you're at the mercy of the system text behavior, which is not the same everywhere, but can vary from language to language.
While neither English nor Swedish consider the hyphen in space-hyphen-letters to be part of a word (e.g. words of "foo -bar" --> {"foo", "bar"}), Swedish (but *not* English) considers space-hyphen-numbers to be a single word. (E.g. words of "-19 -23" --> {"-19" "-23"} in Swedish, but {"19", "23"} in English.)
I tried this on 9.0.4 and 9.1 -- with the text behavior set to Swedish, it considers the leading hyphen to be part of a number-word. Check the Text control panel and make sure it's set to Swedish. If it's not, change it and restart the machine.
--Chris Nebel
AppleScript Engineering