Here's one way
on test
-- Make a list of the num-strings to compare to
nums = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"]
-- Go through the string char by char & if it is a num then subscript it
n = member("name and formula text").char.count
repeat with i = 1 to n
if getPos(nums, member("name and formula text").char[i]) then \
member("name and formula text").char[i].fontStyle = [#SubScript]
end repeat
end
At 3:30 PM -0800 12/31/01, you wrote:
>I'd like to find numbers in a string in a text cast member ("name and
>formula text") and make them subscripts. For example, I'd like to make
>the 2 and 5 in "The formula N2O5 represents the compound named
>dinitrogen pentoxide." subscripts. It's less important but I'd also like
>to be able to make both 2's in "The formula H2O2 represents the compound
>named hydrogen peroxide." subscripts. I'd like to be able to do this in
>a general way for all numbers between 1 and 9, checking for each number
>in any string, and if it is found making it a subscript.
>
>Any ideas on how I can make this happen?
>
>Thanks for the help.
>
>Mark
>
>---------------------------------------------------------------
>Mark Bishop
>www.mpcfaculty.net/mark_bishop/
>[EMAIL PROTECTED]
>
>
>[To remove yourself from this list, or to change to digest mode, go to
>http://www.penworks.com/lingo-l.cgi To post messages to the list,
>email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
>Lingo-L is for learning and helping with programming Lingo. Thanks!]
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]