Re: words in Unicode text
Re: words in Unicode text
- Subject: Re: words in Unicode text
- From: Paul Berkowitz <email@hidden>
- Date: Sun, 16 Mar 2003 03:45:19 -0800
On 3/16/03 1:23 AM, "julifos" <email@hidden> wrote:
>
> At 8:18 pm +0100 15/3/03, julifos wrote:
>
>
>
>> Can anybody confirm/explain this?
>
>>
>
>> "-rw-r--r--"
>
>> (count words of result) (count words of (result as Unicode text))
>
>
>
>
>
> What's the ascii character 2 supposed to mean? Surely you know the
>
> list won't transmit high ascii.
>
>
I forgot it ;-)
>
>
These are my results (snagged character was "is not equal to"):
>
>
#############
>
set x to "-rw-r--r--"
>
set y to x as Unicode text
>
>
words of x --> {"rw", "r", "r"}
>
words of y --> {"rw-r", "r"}
>
#############
>
>
OS 10.2.4 (international, spanish), AS 1.9.1
>
>
I found this issue with text returned from a shell script, which returns
>
Unicode text by default (which is a sh*t for me).
>
>
Actually, I'm trying to retrieve the file size of a given file, and now I
>
don't know if I should handle a possible error:
>
>
#############
>
word 6 of (do shell script "ls -l path/to/file")
>
#############
>
>
... Where I should ask for "word 7" (?)
You shouldn't be using 'word' anyway. Use text item delimiters.
words of "hot-shot"
{"hot-shot"}
words of "-rw-r--r--"
{"rw-r", "r"}
set x to "-rw-r--r--"
words of x
{"rw-r", "r"}
(AS 1.9.1 in both Script Debugger and Script Editor 2.0)
set x to "-rw-r--r--"
set y to x as Unicode text
words of x --> {"rw-r", "r"}
words of y --> {"rw-r", "r"}
Since "r" and "rw" are considered words, "rw-r" is also a word containing a
hyphen, as both string and Unicode. I don't know how you're getting
{"rw", "r", "r"} for words of x: I can't. Are you omitting some step in your
description?
--
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.