![]() |
怎么样把中文数字转换成阿拉伯数字啊?
如题,那位高手能指点一下!
|
回复: 怎么样把中文数字转换成阿拉伯数字啊?
#ALIAS change {#if %1=一 {%2=1};#if %1=二 {%2=2};#if %1=三 {%2=3};#if %1=四 {%2=4};#if %1=五 {%2=5};#if %1=六 {%2=6};#if %1=七 {%2=7};#if %1=八 {%2=8};#if %1=九 {%2=9};#if %1=十 {%2=10}} {math}
#ALIAS change_num {#var temporary1 0;#var temporary2 0;#var temporary3 0;#var temporary4 0;#var temporary5 0;#if %pos(万,%1) {change %left(%1,%pos(万,%1)-1) temporary1};#if %pos(千,%1) {change %rightback(%left(%1,%pos(千,%1)-1),2) temporary2};#if %pos(百,%1) {change %rightback(%left(%1,%pos(百,%1)-1),2) temporary3};#if %pos(十,%1) {change %rightback(%left(%1,%pos(十,%1)-1),2) temporary4};#if %pos(十,%1) {change %rightback(%1,2) temporary5};#if (@temporary5>9) {temporary5=0};#if (%begins(%1,十)) {temporary4=1};#math result 10000*@temporary1+1000*@temporary2+1...temporary5;#if @result=0 {change %1 result}} {math} #ALIAS math {#if %pos(零,%1) {change_num %right(%1,%pos(零,%1)+1);gain=@result;change_num %left(%1,%pos(零,%1)-1);#math gain @gain+@result} {change_num %1;gain=@result}} {math} ============================== 用法: math 一千五百 那么变量gain的值就是1500了 |
回复: 怎么样把中文数字转换成阿拉伯数字啊?
留个脚印,用到了来copy就不用自己写转换了
|
| 所有时间均为格林尼治时间 +9, 现在的时间是 10:47. |
Powered by SPLS
版权所有 2001-2023 水泊梁山
皖ICP备05012024号
站长 fengyue