blob: 617903358133f070a371cf80b327e42824e3068d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#!/bin/ash
str_trim() {
if [ $# = 0 ]; then
tr '\n' '\r' | sed -r 's/^[[:space:]]+//;s/[[:space:]]+$//' | tr '\r' '\n'
else
printf "%s" "$*" | tr '\n' '\r' | sed -r 's/^[[:space:]]+//;s/[[:space:]]+$//' | tr '\r' '\n'
fi
}
str_upper() {
if [ $# = 0 ]; then
tr 'a-z' 'A-Z'
else
printf "%s" "$*" | tr 'a-z' 'A-Z'
fi
}
str_lower() {
if [ $# = 0 ]; then
tr 'A-Z' 'a-z'
else
printf "%s" "$*" | tr 'A-Z' 'a-z'
fi
}
|