查看单个帖子
旧 2008-11-19   #2
locale
初级会员
级别:2 | 在线时长:17小时 | 升级还需:13小时级别:2 | 在线时长:17小时 | 升级还需:13小时
 
locale 的头像
 
注册: 07年11月07日
来自: 乡下
帖子: 47
声望力: 0
声望: 45 locale 初领妙道
积分:6
精华:2
现金:242两梁山币
资产:242两梁山币
致谢数: 0
获感谢文章数:0
获会员感谢数:0
回复: 怎么样把中文数字转换成阿拉伯数字啊?

#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了
帅哥 locale 当前离线  
回复时引用此帖