Skip to content

Commit

Permalink
Remove bh_asc2dec()
Browse files Browse the repository at this point in the history
  • Loading branch information
merces committed Nov 28, 2024
1 parent 586a314 commit 365d9d8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
29 changes: 14 additions & 15 deletions src/math/bh_charcalc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,19 @@ bh_charcalc() {
local i

case $2 in
+|-)
for i in $(echo "$1" | sed 's/./& /g'); do
char=$(bh_asc2dec $i)
res=$(($char $2 $3))
echo -n $(bh_dec2asc $res)
done
echo
;;
'*')
for (( i=0; i<$3; i++ )); do
res="$res$1"
done
echo $res
;;
+|-)
for i in $(echo "$1" | sed 's/./& /g'); do
char=$(bh_str2dec $i)
res=$(($char $2 $3))
echo -n $(bh_dec2asc $res)
done
echo
;;
'*')
for (( i=0; i<$3; i++ )); do
res="$res$1"
done
echo $res
;;
esac

}
5 changes: 0 additions & 5 deletions src/strings/bh_asc2dec.sh

This file was deleted.

7 changes: 7 additions & 0 deletions src/strings/bh_str2dec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@ bh_str2dec() {
echo -n "$1" | hexdump -ve '/1 "%d "' | sed 's/\(.*\) /\1/'
echo
}

bh_asc2dec() {
echo "WARNING: bh_asc2dec() is depcreated and will be removed in the next release. Use bh_str2dec() instead."
(( $# < 1 )) && return 1

bh_str2dec $1
}

0 comments on commit 365d9d8

Please sign in to comment.