the key is iterating backwards. if you iterate forward 1 char at a time,
and you replace one char, the quote, with a multi char string, the
repeat loop gets mighty confused about where it is. the same thing can
happen when you loop through a list, and change the list in the loop. do
it backwards, and the extra characters are added at a point that's after
the iteration point, so the next iteration of the loop deals with the
correct char.

-bhakti, being slightly pedantic

Changhsu Liu wrote:
> 
> At 11:32 PM 7/22/2001 -0400, you wrote:
> >>Is there a way to achieve what I need?
> >
> >Try this:
> >
> >on convertQuote aField
> >   aString = the text of field aField
> >   temp = aString.char.count
> >   quotestring = quote & " & quote & " & quote
> >   repeat with i = temp down to 1
> >     if char i of aString = quote then put quotestring into char i of aString
> >   end repeat
> >   return aString
> >end
> >
> It works great, and thanks a lot for simplifying my unnecessary long
> script. I learned a lot. Thanks!
> 
> Regards,
> 
> Changhsu Liu
> 
> [To remove yourself from this list, or to change to digest mode, go to
> http://www.penworks.com/LUJ/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!]

-- 
R. Bhakti Klein
Instructional Media Developer, Distributed Learning Workshop
http://www.dlworkshop.net/
··
Baritone, Wicki6
http://www.wicki6.com
···
"On Earth, you can only do little things;
but you can do them with a lot of Love."
                              -- Mother Theresa

[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/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!]

Reply via email to