summaryrefslogtreecommitdiffhomepage
path: root/subr/rtl_string.subr
diff options
context:
space:
mode:
Diffstat (limited to 'subr/rtl_string.subr')
-rw-r--r--subr/rtl_string.subr11
1 files changed, 11 insertions, 0 deletions
diff --git a/subr/rtl_string.subr b/subr/rtl_string.subr
index 0e549d3c..2d529786 100644
--- a/subr/rtl_string.subr
+++ b/subr/rtl_string.subr
@@ -12,6 +12,17 @@ rtl_isnumber() {
return "${_rc}";
};
+rtl_subst() {
+ local _s="${1}" _find="${2}" _replace="${3}" _prefix="" _s_new="";
+ while [ -n "${_s}" ]; do
+ case "${_s}" in
+ *${_find}*) _prefix="${_s%%${_find}*}"; _s="${_s#*${_find}}";
+ _s_new="${_s_new:+${_s_new}}${_prefix}${_replace}"; ;;
+ *) _s_new="${_s_new:+${_s_new}}${_s}"; _s=""; ;;
+ esac; done;
+ echo "${_s_new}";
+};
+
rtl_tolower() {
local _s="${1}" _s_new="";
while [ -n "${_s}" ]; do