- 论坛徽章:
- 0
|
- num=$1
- len=`echo $1|awk '{print length($0)}'`
- if [ $num -lt 1 ];then
- len=`expr $len - 2`
- num=`echo $num|awk '{printf("%d",$0*100)}'`
- fi
- j=0
- i=$len
- while [ $i -gt 0 ];do
- cc=`echo $num|awk '{print substr($0,'"$i"',1)}'`
- j=`expr $j + 1`
- case $cc in
- ".")tmp="元";;
- "0")tmp="零";;
- "1")tmp="壹";;
- "2")tmp="贰";;
- "3")tmp="叁";;
- "4")tmp="肆";;
- "5")tmp="伍";;
- "6")tmp="陆";;
- "7")tmp="柒";;
- "8")tmp="捌";;
- "9")tmp="玖";;
- esac
- case $j in
- "1")tmp=$tmp"分";;
- "2")tmp=$tmp"角";;
- "3")tmp=$tmp"";;
- "4")tmp=$tmp"";;
- "5")tmp=$tmp"拾";;
- "6")tmp=$tmp"佰";;
- "7")tmp=$tmp"仟";;
- "8")tmp=$tmp"万";;
- "9")tmp=$tmp"拾";;
- "10")tmp=$tmp"佰";;
- "11")tmp=$tmp"仟";;
- "12")tmp=$tmp"亿";;
- "13")tmp=$tmp"拾";;
- "14")tmp=$tmp"佰";;
- "15")tmp=$tmp"仟";;
- "16")tmp=$tmp"万";;
- esac
- i=`expr $i - 1`
- temp=$tmp$temp
- done
- temp=`echo $temp|sed 's/零拾/零/'`
- temp=`echo $temp|sed 's/零佰/零/'`
- temp=`echo $temp|sed 's/零仟/零/'`
- temp=`echo $temp|sed 's/零零零/零/'`
- temp=`echo $temp|sed 's/零零/零/'`
- temp=`echo $temp|sed 's/零角零分/整/'`
- temp=`echo $temp|sed 's/零分/整/'`
- temp=`echo $temp|sed 's/零分/整/'`
- temp=`echo $temp|sed 's/零亿零万零元/亿元/'`
- temp=`echo $temp|sed 's/亿零万零元/亿元/'`
- temp=`echo $temp|sed 's/零亿零万/亿/'`
- temp=`echo $temp|sed 's/零万零元/万元/'`
- temp=`echo $temp|sed 's/万零元/万元/'`
- temp=`echo $temp|sed 's/零亿/亿/'`
- temp=`echo $temp|sed 's/零万/万/'`
- temp=`echo $temp|sed 's/零元/元/'`
- temp=`echo $temp|sed 's/零零/零/'`
- echo $temp
复制代码
[ 本帖最后由 hwhcom 于 2007-4-29 17:53 编辑 ] |
|