KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: The "\" character in methods
PRODUCT: 4D | VERSION: 2003 | PLATFORM: Mac & Win
Published On: August 19, 2003
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

In 4th Dimension 2003, typing a string entered as "C:\Temp" will be displayed "C:\\Temp".
As we can see, the \ has been duplicated. This is not a bug.

Starting with 4D 2003, you may now use escape sequences in your methods. The available sequences are:
Line feed: \n
Tab: \t
Carriage return: \r
Backslash: \\
Quotes: \"

In previous versions of 4D, we could have the following code:
$message:="He said:" + Char(13) + Char(34) + "Done!" + Char(34)
$tempPath:="C:\Temp\"

With 4D 2003, we can simply use:
$message:="He said:\r\"Done!\""
$tempPath:="C:\\Temp\\"