summaryrefslogtreecommitdiffhomepage
path: root/subr/rtl_string.subr
diff options
context:
space:
mode:
authorLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2020-03-15 09:14:23 +0000
committerLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2020-03-15 09:14:23 +0000
commitb6a9a1a3c8b98077cce47d579069c42080d17da5 (patch)
tree56301493a28e098de840c21b6d7e2776dd5574a1 /subr/rtl_string.subr
parent3e295f4e81f867fbd8b6c9c306bc1ca124e41d8b (diff)
downloadmidipix_build-b6a9a1a3c8b98077cce47d579069c42080d17da5.tar.bz2
midipix_build-b6a9a1a3c8b98077cce47d579069c42080d17da5.tar.xz
General cleanup.
Diffstat (limited to 'subr/rtl_string.subr')
-rw-r--r--subr/rtl_string.subr15
1 files changed, 12 insertions, 3 deletions
diff --git a/subr/rtl_string.subr b/subr/rtl_string.subr
index c30cfe8c..2dd9e27a 100644
--- a/subr/rtl_string.subr
+++ b/subr/rtl_string.subr
@@ -21,6 +21,15 @@ rtl_match() {
fi;
};
+rtl_matchr() {
+ local _s="${1}" _find="${2}";
+ if [ "${_s%${_find}}" != "${_s}" ]; then
+ return 0;
+ else
+ return 1;
+ fi;
+};
+
rtl_subst() {
local _s="${1}" _find="${2}" _replace="${3}" _prefix="" _s_new="";
while [ -n "${_s}" ]; do
@@ -29,7 +38,7 @@ rtl_subst() {
_s_new="${_s_new:+${_s_new}}${_prefix}${_replace}"; ;;
*) _s_new="${_s_new:+${_s_new}}${_s}"; _s=""; ;;
esac; done;
- echo "${_s_new}";
+ printf "%s" "${_s_new}";
};
rtl_tolower() {
@@ -68,7 +77,7 @@ rtl_tolower() {
_s="${_s#[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]}";
done; ;;
esac; done;
- echo "${_s_new}";
+ printf "%s" "${_s_new}";
};
rtl_toupper() {
@@ -107,7 +116,7 @@ rtl_toupper() {
_s="${_s#[^abcdefghijklmnopqrstuvwxyz]}";
done; ;;
esac; done;
- echo "${_s_new}";
+ printf "%s" "${_s_new}";
};
# vim:filetype=sh