Blame subr/ex_rtl_string.subr

Lucio Andrés Illanes Albornoz 2b85d0
#
Lucio Andrés Illanes Albornoz 2b85d0
# set +o errexit -o noglob is assumed.
Lucio Andrés Illanes Albornoz 2b85d0
#
Lucio Andrés Illanes Albornoz 2b85d0
Lucio Andrés Illanes Albornoz 2b85d0
ex_rtl_tolower() {
Lucio Andrés Illanes Albornoz 2b85d0
	local _s="${1}" _s_new="";
Lucio Andrés Illanes Albornoz 2b85d0
	while [ -n "${_s}" ]; do
Lucio Andrés Illanes Albornoz 2b85d0
	case "${_s}" in
Lucio Andrés Illanes Albornoz 2b85d0
	A*)     _s_new="${_s_new:+${_s_new}}a"; _s="${_s#A}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	B*)     _s_new="${_s_new:+${_s_new}}b"; _s="${_s#B}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	C*)     _s_new="${_s_new:+${_s_new}}c"; _s="${_s#C}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	D*)     _s_new="${_s_new:+${_s_new}}d"; _s="${_s#D}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	E*)     _s_new="${_s_new:+${_s_new}}e"; _s="${_s#E}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	F*)     _s_new="${_s_new:+${_s_new}}f"; _s="${_s#F}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	G*)     _s_new="${_s_new:+${_s_new}}g"; _s="${_s#G}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	H*)     _s_new="${_s_new:+${_s_new}}h"; _s="${_s#H}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	I*)     _s_new="${_s_new:+${_s_new}}i"; _s="${_s#I}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	J*)     _s_new="${_s_new:+${_s_new}}j"; _s="${_s#J}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	K*)     _s_new="${_s_new:+${_s_new}}k"; _s="${_s#K}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	L*)     _s_new="${_s_new:+${_s_new}}l"; _s="${_s#L}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	M*)     _s_new="${_s_new:+${_s_new}}m"; _s="${_s#M}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	N*)     _s_new="${_s_new:+${_s_new}}n"; _s="${_s#N}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	O*)     _s_new="${_s_new:+${_s_new}}o"; _s="${_s#O}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	P*)     _s_new="${_s_new:+${_s_new}}p"; _s="${_s#P}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	Q*)     _s_new="${_s_new:+${_s_new}}q"; _s="${_s#Q}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	R*)     _s_new="${_s_new:+${_s_new}}r"; _s="${_s#R}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	S*)     _s_new="${_s_new:+${_s_new}}s"; _s="${_s#S}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	T*)     _s_new="${_s_new:+${_s_new}}t"; _s="${_s#T}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	U*)     _s_new="${_s_new:+${_s_new}}u"; _s="${_s#U}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	V*)     _s_new="${_s_new:+${_s_new}}v"; _s="${_s#V}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	W*)     _s_new="${_s_new:+${_s_new}}w"; _s="${_s#W}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	X*)     _s_new="${_s_new:+${_s_new}}x"; _s="${_s#X}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	Y*)     _s_new="${_s_new:+${_s_new}}y"; _s="${_s#Y}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	Z*)     _s_new="${_s_new:+${_s_new}}z"; _s="${_s#Z}"; ;;
Lucio Andrés Illanes Albornoz 245c93
	[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]*)
Lucio Andrés Illanes Albornoz 245c93
		_s_new="${_s_new:+${_s_new}}${_s%%[ABCDEFGHIJKLMNOPQRSTUVWXYZ]*}";
Lucio Andrés Illanes Albornoz 245c93
		while [ "${_s#[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]}" != "${_s}" ]; do
Lucio Andrés Illanes Albornoz 245c93
			_s="${_s#[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]}";
Lucio Andrés Illanes Albornoz 2b85d0
		done; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	esac; done;
Lucio Andrés Illanes Albornoz 2b85d0
	echo "${_s_new}";
Lucio Andrés Illanes Albornoz 2b85d0
};
Lucio Andrés Illanes Albornoz 2b85d0
Lucio Andrés Illanes Albornoz 2b85d0
ex_rtl_toupper() {
Lucio Andrés Illanes Albornoz 2b85d0
	local _s="${1}" _s_new="";
Lucio Andrés Illanes Albornoz 2b85d0
	while [ -n "${_s}" ]; do
Lucio Andrés Illanes Albornoz 2b85d0
	case "${_s}" in
Lucio Andrés Illanes Albornoz 2b85d0
	a*)     _s_new="${_s_new:+${_s_new}}A"; _s="${_s#a}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	b*)     _s_new="${_s_new:+${_s_new}}B"; _s="${_s#b}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	c*)     _s_new="${_s_new:+${_s_new}}C"; _s="${_s#c}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	d*)     _s_new="${_s_new:+${_s_new}}D"; _s="${_s#d}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	e*)     _s_new="${_s_new:+${_s_new}}E"; _s="${_s#e}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	f*)     _s_new="${_s_new:+${_s_new}}F"; _s="${_s#f}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	g*)     _s_new="${_s_new:+${_s_new}}G"; _s="${_s#g}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	h*)     _s_new="${_s_new:+${_s_new}}H"; _s="${_s#h}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	i*)     _s_new="${_s_new:+${_s_new}}I"; _s="${_s#i}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	j*)     _s_new="${_s_new:+${_s_new}}J"; _s="${_s#j}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	k*)     _s_new="${_s_new:+${_s_new}}K"; _s="${_s#k}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	l*)     _s_new="${_s_new:+${_s_new}}L"; _s="${_s#l}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	m*)     _s_new="${_s_new:+${_s_new}}M"; _s="${_s#m}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	n*)     _s_new="${_s_new:+${_s_new}}N"; _s="${_s#n}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	o*)     _s_new="${_s_new:+${_s_new}}O"; _s="${_s#o}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	p*)     _s_new="${_s_new:+${_s_new}}P"; _s="${_s#p}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	q*)     _s_new="${_s_new:+${_s_new}}Q"; _s="${_s#q}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	r*)     _s_new="${_s_new:+${_s_new}}R"; _s="${_s#r}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	s*)     _s_new="${_s_new:+${_s_new}}S"; _s="${_s#s}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	t*)     _s_new="${_s_new:+${_s_new}}T"; _s="${_s#t}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	u*)     _s_new="${_s_new:+${_s_new}}U"; _s="${_s#u}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	v*)     _s_new="${_s_new:+${_s_new}}V"; _s="${_s#v}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	w*)     _s_new="${_s_new:+${_s_new}}W"; _s="${_s#w}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	x*)     _s_new="${_s_new:+${_s_new}}X"; _s="${_s#x}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	y*)     _s_new="${_s_new:+${_s_new}}Y"; _s="${_s#y}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	z*)     _s_new="${_s_new:+${_s_new}}Z"; _s="${_s#z}"; ;;
Lucio Andrés Illanes Albornoz 245c93
	[^abcdefghijklmnopqrstuvwxyz]*)
Lucio Andrés Illanes Albornoz 245c93
		_s_new="${_s_new:+${_s_new}}${_s%%[abcdefghijklmnopqrstuvwxyz]*}";
Lucio Andrés Illanes Albornoz 245c93
		while [ "${_s#[^abcdefghijklmnopqrstuvwxyz]}" != "${_s}" ]; do
Lucio Andrés Illanes Albornoz 245c93
			_s="${_s#[^abcdefghijklmnopqrstuvwxyz]}";
Lucio Andrés Illanes Albornoz 2b85d0
		done; ;;
Lucio Andrés Illanes Albornoz 2b85d0
	esac; done;
Lucio Andrés Illanes Albornoz 2b85d0
	echo "${_s_new}";
Lucio Andrés Illanes Albornoz 2b85d0
};
Lucio Andrés Illanes Albornoz 2b85d0
Lucio Andrés Illanes Albornoz 2b85d0
# vim:filetype=sh