FunctionPackage: exclToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version

make-escaped-string

Arguments: string &key (escape #\%) (passed (function alphanumericp)) escaped

If the argument string does not contain any characters that need to be escaped (as described below), then the value returned is the input argument string.

Otherwise, this function returns a new string in which some characters are replaces with the character triples %hh where % is the escape character (as specified by the escape keyword argument) and hh is the two-digit hexadecimal representation of the character code.

This function only handles characters with a char-code values under 256 (255 is the largest value that can be represented by a two-digit hex value).

Strings of this form are useful as companion arguments to the -ee command line argument. (See Command line argumentsand Further description of the -e and -ee command-line arguments, both in startup.htm.)

A character is replaced with the escaped sequence if any of the following is true:

The escaped and passed arguments may be

For example, suppose you want to evaluate the form (foo:bar #\a "efg") on startup. Constructing the correct comapnion argument to -e is difficult (we won't even try). But we can find the escaped string with this function (not we double the backslash and escape the double-quotes):

cl-user(34): (make-escaped-string "(foo:bar #\\a \"efg\")")
"%28foo%3abar%20%23%5ca%20%22efg%22%29"
cl-user(35): 

And use -ee %28foo%3abar%20%23%5ca%20%22efg%22%29.

The argument -ee %28foo%3abar%20%23%5ca%20%22efg%22%29, while obscure, conveys the desired expression with no trouble at all (and it can be decoded by hand if necessary).


Copyright (c) 1998-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version