docs: update
This commit is contained in:
parent
c5b724c7ce
commit
5c6dca34ef
16
README.md
16
README.md
|
@ -31,6 +31,7 @@ scripts and not full blown utilities.
|
|||
* [Get the last N lines of a file.](#get-the-last-n-lines-of-a-file)
|
||||
* [Get the number of lines in a file.](#get-the-number-of-lines-in-a-file)
|
||||
* [Strings](#strings)
|
||||
* [Trim white-space from string.](#trim-white-space-from-string)
|
||||
* [Split a string on a delimiter.](#split-a-string-on-a-delimiter)
|
||||
* [Change a string to lowercase.](#change-a-string-to-lowercase)
|
||||
* [Change a string to uppercase.](#change-a-string-to-uppercase)
|
||||
|
@ -117,6 +118,21 @@ lines() {
|
|||
## Strings
|
||||
|
||||
|
||||
### Trim white-space from string.
|
||||
|
||||
**NOTE**: This also truncates multiple spaces inside the string.
|
||||
|
||||
```sh
|
||||
# shellcheck disable=SC2086,SC2048
|
||||
trim() {
|
||||
# Usage: trim " example string "
|
||||
set -f
|
||||
set -- $*
|
||||
printf '%s\n' "$*"
|
||||
set +f
|
||||
}
|
||||
```
|
||||
|
||||
### Split a string on a delimiter.
|
||||
|
||||
```sh
|
||||
|
|
Loading…
Reference in New Issue