PPWIZARD is a free preprocessor for HTML, REXX, Visual Basic or any text files.
[Bottom][Contents][Search][Prev]: QueryExists()[Next]: RandomString()

QuoteIt()

This is a rexx function provided by PPWIZARD. This routine (like all PPWIZARD extensions) can be used with any operating system supported by PPWIZARD.

This function will examine the string you supply and determine a quote character which could safely be used to quote it (that is the string does not contain it). By default only the quote character is returned. Processing will abort if a quote character can't be determined.

The function requires at least the first parameter as follows:

  1. The string that you wish to quote.

  2. An optional list of all possible quote characters. If not supplied it defaults to trying double then single quotes. If you pass "ANY" then a default (long) list of characters is used.

  3. An optional parameter to indicate whether or not you wish the quoted value returned (by default it is not). Pass "Y" to have the quoted string returned rather than just the quote character.

This routine is handy when a macro is passed some information and needs to generate the data in a quoted format. Some languages such as HTML allow information to be quoted with either a single or a double quote.

Stupid Examples

    #evaluate     ''  ~RxQuote=QuoteIt('AS"DF')~
    Should be double = <??RxQuote>
    #evaluate     ''  ~RxQuote=QuoteIt("AS'DF")~
    Should be single = <??RxQuote>
    #evaluate     ''  ~RxContainsBothQuotes = 'AS"' || "'DF"~
    #evaluate     ''  ~RxQuote=QuoteIt(RxContainsBothQuotes, '"' || "'^")~
    Should be '^'    = <??RxQuote>
    #evaluate     ''  ~RxQuote=QuoteIt(RxContainsBothQuotes)~   ;;Will die
    


[Top][Contents][Search][Prev]: QueryExists()[Next]: RandomString()

PPWIZARD Manual
My whole website and this manual itself was developed using PPWIZARD (free preprocessor written by Dennis Bareis)
Thursday January 17 2002 at 6:27pm