This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
- edited on
Suppose you need to change single quotes to double quotes in an expression; i.e. write a formula in an Action, Condition, Filter, Formula, Generate Rows, Multi Field Formula, Multi Row Formula, Charting, Report Map, Table, Message, or Test tool.
To do this, you use the REPLACE function. This is a string function in the format:
REPLACE([FieldName], ‘x’, ‘y’)
where ‘x’ gets replaced by ‘y’ in [FieldName].
Generally, it is not a good idea to mix single quotes with double quotes as this can sometimes produce unexpected results. In other words, avoid using this syntax:
REPLACE([FieldName], ‘x’, “y”)
You might be tempted to write your REPLACE expression like this:
But this gives you the ‘Malformed Function Call’ error message.
At this point, you may think the double quotes need to be single quotes like this:
But, again, you get the ‘Malformed Function Call’ message.
For this expression to work correctly, the expression should be written like this:
In other words, the single quote needs to be wrapped by double quotes, and the double quote needs to be wrapped by single quotes!
An alternate way to do this, without the confusion of which quotation marks to use is to take advantage of a (probably little used) conversion function -- CharFromInt.
To replace the single quote, your expression would be:
If you don't know which character numbers to use, run a Generate Rows tool up to 255, and add a formula and run CharFromInt() on the generated rows.