How can I add special characters to a string?

The need occasionally arises to embed a double-quote or other characters inside a text string in an InduSoft Web Studio project.  Since defining text strings are normally done by putting the string to be saved within double-quotes, it is not simply a matter of putting a double-quote or other non-printable characters inside double-quotes (“”").  If you attempt it, an error will be returned.

The most common method for embedding a double-quote character in a text string is by concatenation.  This method will work in virtually all cases:

$sExampleStringTag = “This is a double-quote character: ” + $Asc2Str(34) + ” .”

String Result: This is a double-quote character: ” .

Using an ASCII Character Table (Web search for “ASCII Character Table”), it is possible to find any ASCII character, even unprintable ones, and embed them into a text string using concatenation. Using the decimal value of the ASCII Code, use the function ASC2Str() and enter the value inside the parentheses.

Parents
  • You can also just use two double-quotes inside a quoted string as shown below,
    $sExampleStringTag = "This is a double-quote character: ""."

    When VBScript sees two consecutive double quote characters in a quoted string, then it is interpreted as a single double-quote character.

    Larry Combs
    InduSoft Technical Support Team
Reply
  • You can also just use two double-quotes inside a quoted string as shown below,
    $sExampleStringTag = "This is a double-quote character: ""."

    When VBScript sees two consecutive double quote characters in a quoted string, then it is interpreted as a single double-quote character.

    Larry Combs
    InduSoft Technical Support Team
Children
No Data