Please enable JavaScript to view this site.

A-Shell Consolidated Reference

Updated February 2019; see History

EDIT$(expr$, flags)

The EDIT$ function modifies the specified string expression expr according to one or more of the following flags as defined in ASHINC:ASHELL.DEF.

Symbol

Value

Description

EDITF_SPTB

&h0002

remove spaces and tabs

EDITF_CTLS

&h0004

remove chr(127) & chr(0)-chr(31) except TAB

EDITF_SPTBL

&h0008

remove leading spaces and tabs  

EDITF_SPTB1

&h0010

shrink spaces & tabs to one space

EDITF_SPTBR

&h0020

remove trailing spaces and tabs

EDITF_UNQT

&h0040

unquote (and reduce "" to "). EDITF_UNQT performs two operations: 1) if the first and last character, after any other processing (such as removal of leading/trailing spaces and tabs) are both quotes ("), then are removed.  2) Any remaining double quotes ("") which are not preceded by a regular quotes are reduced to regular quotes ("), unless the string has been reduced to a single pair of quotes ("").

EDITF_EXQT

&h0080

limits action to outside matched quotes. Exemption for quoted strings allows for multiple quoted subsections. This works well with JSON documents, which may contain many individually quoted strings, yet it may be convenient to remove all the whitespace not within those quoted strings.

EDITF_Z

&h0100

applied after any other flags, and converts a string containing just "0" to "".

EDITF_SPTBZ

&h0128

EDITF_SPTBZ is a combination of EDITF_SPTBR, EDITF_SPTBL and EDITF_Z; it first removes leading and trailing spaces and tabs, and if the result is just "0", then removes it too, returning "".

 

Examples

S$                       After EDIT$(S$,EDITF_SPTB+EDITF_EXQT)

---------------------    ------------------------------------------

"name" : "v1 v2"         "name":"v1 v2"

"name" : v1 v2           "name":v1v2

"name : v1 v2" ]         "name : v1 v2"]

"6"" ruler"              "6"" ruler"  

 

S$                       After EDIT$(S$,EDITF_UNQT)

---------------------    ------------------------------------------

"6"" ruler"              6" ruler

"6"" ruler":$1.99        "6"" ruler":$1.99      

 

In the last example above, the outer quotes were not removed because they didn't completely enclose the string, and the "" was not reduced to " because it followed a " character.

History

2019 February, A-Shell 6.5.1656:  Add flags EDITF_Z and EDOTF_SPTBZ. These are mainly useful in mixed number/string situations where the distinction between a null strings, strings containing just blanks, strings containing just "0", or some combination, are all to be treated equivalently.

2016 October, A-Shell 6.3.1534:  Add flags EDITF_UNQT and EDITF_EXQT