Add reverse case function
This commit is contained in:
@@ -209,6 +209,32 @@ $ upper "HELLO"
|
||||
HELLO
|
||||
```
|
||||
|
||||
## Reverse a string case
|
||||
|
||||
**CAVEAT:** Requires `bash` 4+
|
||||
|
||||
**Example Function:**
|
||||
|
||||
```sh
|
||||
reverse_case() {
|
||||
# Usage: reverse_case "string"
|
||||
printf '%s\n' "${1~~}"
|
||||
}
|
||||
```
|
||||
|
||||
**Example Usage:**
|
||||
|
||||
```shell
|
||||
$ reverse_case "hello"
|
||||
HELLO
|
||||
|
||||
$ reverse_case "HeLlO"
|
||||
hElLo
|
||||
|
||||
$ reverse_case "HELLO"
|
||||
hello
|
||||
```
|
||||
|
||||
## Trim quotes from a string
|
||||
|
||||
**Example Function:**
|
||||
|
||||
Reference in New Issue
Block a user