偶闲着没事情做,就随便写了个.刚写的:
<%
'****************************
'方法名:NumToCo
'参
数:str
'返回值:全部替换后再返回str
'****************************
PRIVATE FUNCTION NumToCo(str)
DIM MyCo,ReStr,UpCo,LenStr,i,NewString()
MyCo="零|一|二|三|四|五|六|七|八|九"
ReStr="0|1|2|3|4|5|6|7|8|9"
UpCo="万|千|百|十| "
MyCo=Split(MyCo,"|")
ReStr=Split(ReStr,"|")
UpCo=Split(UpCo,"|")
LenStr=Len(str)
ReDim NewString(LenStr)
i=0
Response.Write("<hr>")
Response.Write("<br>原数="&str&"<br>")
'Response.Write("LenStr="&LenStr&"<br>")
dim j
select case LenStr
case 5
j=0
case 4
j=1
case 3
j=2
case 2
j=3
case 1
k=2
case else
end select
if LenStr>1 then
While(i<LenStr)
NewString(i)=Mid(str,i+1,1)&UpCo(j+i)
i=i+1
Wend
Else
NewString(0)=str
End If
str=null
'//重新组合
For i=0 To Ubound(NewString)
str=str&NewString(i)
Next
LenStr=Len(str)
'//进行转换
dim n:n=0
do until n> Ubound(ReStr)
if instr(str,ReStr(n))>0 then str=Replace(str,ReStr(n),MyCo(n))
n=n+1
loop
'//返回值
NumToCo=str
END FUNCTION
'//任意调用:
Response.Write("转换后="&NumToCo("6"))
Response.Write("转换后="&NumToCo("46"))
Response.Write("转换后="&NumToCo("356"))
Response.Write("转换后="&NumToCo("6657"))
Response.Write("转换后="&NumToCo("65756"))
%>