docs: update
This commit is contained in:
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 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)
|
* [Get the number of lines in a file.](#get-the-number-of-lines-in-a-file)
|
||||||
* [Strings](#strings)
|
* [Strings](#strings)
|
||||||
|
* [Trim white-space from string.](#trim-white-space-from-string)
|
||||||
* [Split a string on a delimiter.](#split-a-string-on-a-delimiter)
|
* [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 lowercase.](#change-a-string-to-lowercase)
|
||||||
* [Change a string to uppercase.](#change-a-string-to-uppercase)
|
* [Change a string to uppercase.](#change-a-string-to-uppercase)
|
||||||
@@ -117,6 +118,21 @@ lines() {
|
|||||||
## Strings
|
## 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.
|
### Split a string on a delimiter.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|||||||
Reference in New Issue
Block a user