KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to search and replace characters in a string
PRODUCT: 4D | VERSION: 2004 | PLATFORM: Mac & Win
Published On: March 10, 2006
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

Here is sample code that will help search and replace characters in a string.

The example code is searching for the "é" character, which is 142 on the ascii chart. It will be replaced by the character "t".

For ($i;1;Length(vstring))

   If (Ascii(vstring[[$i]])=142)

     vstring[[$i]]:="t" ` replace the character

   End if

End for