![]() |
[抛砖引玉] 中文数字转换罗马数字机器人
1 个附件
其实也不是机器人拉,就一个trigger,用的上的朋友请下载,高手有空的话帮帮忙改改code找找bug吧..
bow 指令是: chat chanum "中文数字" 例子: chat chanum 九千九百九十九 |
回复: [抛砖引玉] 中文数字转换罗马数字机器人
顺便说下,此机器不能转换“亿"
|
回复: [抛砖引玉] 中文数字转换罗马数字机器人
1 个附件
压缩版 .
|
回复: [抛砖引玉] 中文数字转换罗马数字机器人
checkNum = 0
correctNum = 1 tmp = %2 chatName = %1 showNum = @tmp #math tmpCount {%len( @tmp) / 2} tmpLen = %len( @tmp) #loop 1,@tmpCount { #math tmpLen {@tmpLen - 2} tmpNum = %db( @convertChineseNum, %left( @tmp, 2)) #addkey tmpNumList {%i} {@tmpNum} @tmp = %rightback( @tmp, @tmpLen) } #loopdb @tmpNumList { #if %val>99 { #math lastPos {%key - 1} #math nextPos {%key + 1} lastNum = %db( @tmpNumList, @lastPos) nextNum = %db( @tmpNumList, @nextPos) #if %val=10000 { #math lastTwoPos {%key - 2} lastTwoNum = %db( @tmpNumList, @lastTwoPos) #if @lastNum!=10 {#math checkNum {@checkNum * %val}} #unvar lastTwoPos #unvar lastTwoNum } {#math checkNum {@checkNum + @lastNum*%val}} #if @nextNum>9 {#if @nextNum!=10000 {correctNum = 0}} #unvar lastPos #unvar nextPos #unvar lastNum #unvar nextNum } #if %val=0 { #math nextPos {%key + 1} nextNum = %db( @tmpNumList, @nextPos) #math nextTwoPos {%key + 2} nextTwoNum = %db( @tmpNumList, @nextTwoPos) #if @nextTwoNum<10 {#math checkNum {@checkNum + @nextNum}} #if @nextTwoNum=10000 {#math checkNum {@checkNum + @nextNum}} #if @nextNum>9 {correctNum = 0} #unvar nextPos #unvar nextNum #unvar nextTwoPos #unvar nextTwoNum } #if %val=10 { #math lastPos {%key - 1} #math nextPos {%key + 1} lastNum = %db( @tmpNumList, @lastPos) nextNum = %db( @tmpNumList, @nextPos) #if !@lastNum {#if @nextNum!=10000 {#math checkNum {@checkNum + %val + @nextNum}} {#math checkNum {%val * @nextNum}}} {#if @nextNum!=10000 {#math checkNum {@checkNum + @lastNum*%val + @nextNum}} {#math checkNum {(@checkNum + @lastNum*%val) * @nextNum}}} #if @nextNum>9 {#if @nextNum!=10000 {correctNum = 0}} #unvar lastPos #unvar nextPos #unvar lastNum #unvar nextNum } #if %key=@tmpCount { #if %val<10 { #math lastPos {%key - 1} lastNum = %db( @tmpNumList, @lastPos) #if @lastNum<10 {#if @lastNum>0 {correctNum = 0}} #unvar lastPos #unvar lastNum } } #if @tmpCount=1 {checkNum = %db( @tmpNumList, %key)} } #if @correctNum=0 {chat %1, 数字错误:@showNum} {chat %1, 数字为: @checkNum} #unvar tmpNumList #unvar checkNum #unvar correctNum #unvar tmp #unvar chatName #unvar showNum #unvar tmpLen #unvar tmpCount #unvar tmpNum |
回复: [抛砖引玉] 中文数字转换罗马数字机器人
这个用在什么地方tenten
|
回复: [抛砖引玉] 中文数字转换罗马数字机器人
这个。。。技术活太多,实用性不强啊。。。
|
回复: [抛砖引玉] 中文数字转换罗马数字机器人
引用:
:em01::em01: |
| 所有时间均为格林尼治时间 +9, 现在的时间是 18:37. |
Powered by SPLS
版权所有 2001-2023 水泊梁山
皖ICP备05012024号
站长 fengyue