implement string unescape

Fixes #3543
This commit is contained in:
Kurtis Rader
2017-06-22 20:47:54 -07:00
parent 60bca14b37
commit f3cb625802
8 changed files with 319 additions and 34 deletions

View File

@@ -18,6 +18,7 @@ string sub [(-s | --start) START] [(-l | --length) LENGTH] [(-q | --quiet)]
[STRING...]
string trim [(-l | --left)] [(-r | --right)] [(-c | --chars CHARS)]
[(-q | --quiet)] [STRING...]
string unescape [--style=xxx] [STRING...]
string upper [(-q | --quiet)] [STRING...]
\endfish
@@ -42,6 +43,8 @@ The second is `--style=var` which ensures the string can be used as a variable n
The third is `--style=url` which ensures the string can be used as a URL by hex encoding any character which is not legal in a URL. The string is first converted to UTF-8 before being encoded.
`string unescape` performs the inverse of the `string escape` command. If the string to be unescaped is not properly formatted it is ignored. For example, doing `string unescape --style=var (string escape --style=var $str)` will return the original string.
\subsection string-join "join" subcommand
`string join` joins its STRING arguments into a single string separated by SEP, which can be an empty string. Exit status: 0 if at least one join was performed, or 1 otherwise.