Wouldn't something like this work?

repeat while offset(stringToCheck,charToFind)

  -- get the found character's position in the string
  tCharNum = offset(stringToCheck,charToFind)

  -- put in the replacement character
  put replacementChar after stringToCheck.char[tCharNum]

  -- remove the original character
  delete stringToCheck.char[tCharNum]

end repeat

The repeat loop would run until you've found all instances of the character you want 
to remove and replaced them with the new character. No if...then... structures of 
mammoth proportions, just one loop, nice'n'pretty.

Cheers,
Tom


> -----Original Message-----
> From: Kerry Thompson [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 09, 2002 3:51 PM
> To: [EMAIL PROTECTED]
> Subject: <lingo-l> Character substitution
> 
> 
> There's gotta be a better way to do this (and I should know it).
> 
> I need to convert some high-ANSI Spanish characters to their 
> unaccented
> ASCII equivalents. For example, � (that's o with a right-accent, if it
> doesn't make it across e-mail) needs to be o, no accent. Basically, I
> need to remove all the accented characters from a file name, 
> and replace
> them with unaccented characters.
> 
> I can do an series of "if" checks, checking offset(). There are 12
> accented Spanish characters, though--that's a lot of if...or..or..or..
> 
> Is there a simpler way to check? Contains() doesn't do it, and I don't
> see a way to do it with a list.
> 
> Cordially,
> 
> Kerry Thompson
> 
> 
> [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!]

Reply via email to