Lost In Lists... (Again)
Lost In Lists... (Again)
- Subject: Lost In Lists... (Again)
- From: Peter Bunn <email@hidden>
- Date: Fri, 28 Mar 2003 12:22:36 -0600
I know an almost identical subject ("Determining item number matching "x"
in a list") was beaten to death here this past week, but most of the
examples were obscure enough as to be well over my head.
For reasons not altogether clear to me, I'm trying to work out a
(limited) plain text to HTML Unicode conversion scheme.
Using the Unicode osax, I generated a list of the first 500 Unicode
characters (or those characters as provided by the osax). The list (as
property) is set to 'Uni_chars' in the following snippet.
(The full list and script snippet can be found (as text) at -
http://www.mhtc.net/~bunnz/script.sit
- many of the characters wouldn't survive the list server).
Two things... my approach is very slow. If anyone has the patience,
would you be good enough to suggest a speedier alternative... preferably
using transparent/literal variable terms? Also, the character 'i' (and
doubtless many others, though not yet tested) returns two Unicode
reference numbers. Is this likely an error in the osax generated list or
is this just the _wrong_ way to go about this problem? I confess to
having gotten a little dizzy even working this much out.
As always, help is welcome. A trip to Mars is the only reward proffered.
Thanks.
Peter B.
----------
--property Uni_chars: -- the list of Unicode characters
set the_text to "Godzilla As We Know Him"
set temp_string to ""
considering case
repeat with this_char from 1 to count of the_text
set this_char to character this_char of the_text
repeat with this_num from 1 to count of Uni_chars
if item this_num of Uni_chars is this_char then
set temp_string to temp_string & "&#" & this_num & ";" as string
end if
end repeat
end repeat
end considering
set Uni_text to temp_string
---------------------------------
_______________________________________________
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.