addQuotes Method

Class: String

Description

This method adds one layer of quotes to the specified string. The specified quote character will be added to either side of the string. Occurrences of the quote character inside the string will be doubled. This method replaces the $$QADD^%ZS() function.

Syntax

StringObject.addQuotes(String character)

Parameters

character

A single character that will be treated as a quote character and added to either side of the string to which the method is applied. If not specified, the double quote character (") is used.

Returns

A String.

When Became Available

v7.0

Example

type String STR = "Just a 'string'!"

 

// Using PSL string delimiter

type String QU2 = STR.addQuotes()    // only " on both sides

 

// Using SQL string delimiter

// Will produce "'Just a ''string''!'"

type String QU1 = STR.addQuotes("'")