# EDIT\$()
> [HTML Version](edit$().htm)
_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](ashincincludefiles.htm.md):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