diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a7b89471..eb5b433f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ This section is for changes merged to the `major` branch that are not also merge - `bind` has a new `--silent` option to ignore bind requests for named keys not available under the current `$TERMINAL` (#4188, #4431) - Globs are faster (#4579) - `string` reads from stdin faster (#4610) +- `string split` supports `-n/--no-empty` to exclude empty strings from the result (#4779) - `cd` tab completions no longer descend into the deepest unambiguous path (#4649) - Setting `$PATH` no longer warns on non-existent directories, allowing for a single $PATH to be shared across machines (e.g. via dotfiles). - `funced` now has a `-s` and `--save` option to automatically save the edited function after successfully editing (#4668). diff --git a/doc_src/string.txt b/doc_src/string.txt index fb19dddc2..04b44884d 100644 --- a/doc_src/string.txt +++ b/doc_src/string.txt @@ -12,7 +12,7 @@ string repeat [(-n | --count) COUNT] [(-m | --max) MAX] [(-N | --no-newline)] [(-q | --quiet)] [STRING...] string replace [(-a | --all)] [(-f | --filter)] [(-i | --ignore-case)] [(-r | --regex)] [(-q | --quiet)] PATTERN REPLACEMENT [STRING...] -string split [(-m | --max) MAX] [(-r | --right)] [(-q | --quiet)] SEP +string split [(-m | --max) MAX] [(-n | --no-empty)] [(-q | --quiet)] [(-r | --right)] SEP [STRING...] string sub [(-s | --start) START] [(-l | --length) LENGTH] [(-q | --quiet)] [STRING...] @@ -89,7 +89,7 @@ Exit status: 0 if at least one replacement was performed, or 1 otherwise. \subsection string-split "split" subcommand -`string split` splits each STRING on the separator SEP, which can be an empty string. If `-m` or `--max` is specified, at most MAX splits are done on each STRING. If `-r` or `--right` is given, splitting is performed right-to-left. This is useful in combination with `-m` or `--max`. Exit status: 0 if at least one split was performed, or 1 otherwise. +`string split` splits each STRING on the separator SEP, which can be an empty string. If `-m` or `--max` is specified, at most MAX splits are done on each STRING. If `-r` or `--right` is given, splitting is performed right-to-left. This is useful in combination with `-m` or `--max`. With `-n` or `--no-empty`, empty results are excluded from consideration (e.g. `hello\n\nworld` would expand to two strings and not three). Exit status: 0 if at least one split was performed, or 1 otherwise. See also `read --delimiter`.