Assigning a string containing double quotes

<< Click to Display Table of Contents >>

Manual > Screen Creation Guide > Script > Script Example > Script Tips >

Assigning a string containing double quotes

Assigning a string containing double quotes

When assigning a string to a variable, it is necessary to enclose the string in double quotation marks "". If you try to assign a string containing double quotation marks to a variable, for example, the following code will cause a script error.

 

 

var filter ;

filter = “[CM1]==”Minor fault””; //Example of error

 

 

 

In situations like this, you can use the Chr method, which returns the character with the ASCII code specified as an argument.

 

•Assigning a string containing double quotes
 

var filter;

filter = "[CM1]==" + ::Chr(34) + "Minor fault" + ::Chr(34); //Chr(34) returns double quotes