If you're using Dir 10, it seems like using the built-in regular
expression capabilities of Javascript syntax would be a lot faster.
At 1156 -0500 02/17/2006, Kurt Griffin wrote:
Hi list,
I have an interesting problem. I have an app where the user can
import some rtf into a flash sprite, and maintain basic formatting.
To do that, I filename an rtf member to the chosen file, and then
grab the html to pass into Flash. This works just fine, but with one
issue. Upper ANSI chars get converted to HTML character entities in
the process.
So, I wrote a parser to swap those back. The only problem is, the
check is not case sensitive, so "á" is the same as
"Á". I tried to implement a list to do the check
([search_term] = [entity]), but the problem with that is that I'm
using a "while" loop, which will get stuck on "Á". I can't
simply move on to the next check, because there might be an
"Á" later on.
I suppose I could change the while loop to a for loop, but that
would be much less efficient. Or perhaps store the "old_text" below
along with it's character location in another list, replace the old
text with a bunch of bullets or something (I'd need to maintain the
correct length of the string), and then loop through the new list to
do the case sensitive check?
Any thoughts?
-- html_elements is a prop list of the form ["Á": "Á"]
repeat with i = 1 to html_elements.count
search_term = html_elements[i]
replace_term = html_elements.getPropAt(i)
repeat while offset(search_term, rawString) > 0
start_char = offset(search_term, rawString)
old_text =
rawString.char[start_char..start_char+search_term.char.count-1]
put replace_term into
rawString.char[start_char..start_char+search_term.char.count-1]
end repeat
end repeat
...
[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!]