KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Replacing all occurrences of character(s) in a string
PRODUCT: 4D | VERSION: 2004.2 | PLATFORM: Mac & Win
Published On: November 8, 2005

You can replace all occurrences of characters in a string or text with a new character or string using the Replace string command. This command takes the following parameters: Replace string (source; oldString; newString{; howMany}) and returns the resulting string. You just need to omit the last parameter of the said command to replace all occurrences. For instance, the code below will replace all the Tab characters in the string with spaces:

mytext:=Replace string(mytext;Char(9);" ")