Tech Tip: Adding quotes inside of a string
PRODUCT: 4D | VERSION: 13.0 | PLATFORM: Mac & Win
Published On: June 29, 2012
There are many reasons to use the quote characters inside of a string. For example, if using the WEB SEND TEXT command with a text variable the text might have HTML attributes which require quotes. Or perhaps a text variable on a form needs to have a section quoted.
This requires special attention because 4D has no wa of knowing which quotes are to be displayed and qhich quotes are marking the end of the string.
There are two ways to do this. The first is to use the escape character '"\" befire the quote to be included in the string.
ALERT("This is an example of a \"quote\" within a quote") |
The other option is to use the Char command.
ALERT("ThIs is an example of a " + char(Quote) + "quote" + char(Quote) + " within a quote") |
Both examples produce the same results.