中文数字转字符数字

作者在 2015-08-21 21:28:22 发布以下内容
CLEAR 
cStr="第一百零七章 好事多磨"
=ALINES(Astr,cStr,"第","章")
nLen=0
cLstr=""
cRstr=""
cStr1=astr[2]
* 左取两个字符
IF LEFT(cStr1,2)="十" AND LEN(cStr1)>2
    cLstr="1"
    cStr1=cLstr+SUBSTR(astr[2],3)
ENDIF 
* 右取两个字符
DO CASE
    CASE RIGHT(cStr1,2)="十" AND LEN(cStr1)=2
        cRstr="10"
        nLen=2
    CASE RIGHT(cStr1,2)="十" AND LEN(cStr1)>2
        cRstr="0"
        nLen=2
    CASE RIGHT(cStr1,2)="百" AND LEN(cStr1)>2
        cRstr="00"
        nLen=2
ENDCASE
cStr1=LEFT(cStr1,LEN(cStr1)-nLen)+cRstr
cStr1=CHRTRANC(CHRTRANC(cStr1,"百十",""),"零一二三四五六七八九","0123456789")
?"第 "+PADL(cStr1,4,"0")+" 章"+Astr[3]
数据处理问题 | 阅读 2578 次
文章评论,共0条
游客请输入验证码
浏览402050次