stripQuotes Method

Class: String

Description

This method strips the specified quote character from the string. This method is the inverse of String.addQuotes(). Applying String.stripQuotes() after applying String.addQuotes() yields the original value.

 

The stripQuotes method applies the following algorithm:

This method replaces the $$QSUB^%ZS() function.

Syntax

StringObject.stripQuotes(String char)

Parameters

char

The quote character to strip from the string. If absent or empty, the double quote (") is used.

Returns

A String.

When Became Available

v7.0

Example

type String STR = "'This is just a ''String''!'"

 

// Since STR does not contain ", next examples return STR

type String SAME = STR.stripQuotes()    // SAME = STR

set SAME = STR.stripQuotes("")

set SAME = STR.stripQuotes("""")

 

// Removing layer of single quote ('), all paired

// returns "This is just a 'String'!"

// This is the only example that will deliver the original

// string when addQUotes() is applied afterwards

type String STRIP = STR.stripQuotes("'")

type String ORIG = STRIP.addQuotes("'")

if STR=ORIG write "inverse!"

 

// Next one produces "'Thisisjusta''String''!'"

type NOSP = STR.stripQuotes(" ")       // removes all spaces

 

// Next one produces "m, swiming in sumer is nice"

type String SUMMER = "mmm, swimming in summer is nice"

set STRIP = SUMMER.stripQuotes("m")