靠,这里太窄
<SCRIPT LANGUAGE=vbs>
'先转换三十一,三十,二十九依次类推,然后再转换其他小于十的
function Tsmalldate(sdate)
Tsmalldate=Trim(sdate)
dim MyStr(10)
MyStr(0)="○":MyStr(1)="一":MyStr(2)="二":MyStr(3)="三":MyStr(4)="四"
MyStr(5)="五":MyStr(6)="六":MyStr(7)="七":MyStr(8)="八":MyStr(9)="九"
MyStr(10)="十"
'先考虑三十一和三十,最大是三十一了,不可能有别的。
Tsmalldate=Replace(Tsmalldate,"三十一","31")
Tsmalldate=Replace(Tsmalldate,"三十","30")
'然后是二十一到二十九内的
for i=1 to 9
if instr(Tsmalldate,"二十" & MyStr(i)) then
Tsmalldate=Replace(Tsmalldate,"二十" & MyStr(i),"2" & i)
end if
next
'然后是二十
Tsmalldate=Replace(Tsmalldate,"二十" ,"20")
'然后是十一到十九的
for i=1 to 9
if instr(Tsmalldate,"十" & MyStr(i)) then
Tsmalldate=Replace(Tsmalldate,"十" & MyStr(i),"1" & i)
end if
next
' 剩下的就是普通数字了
for i=0 to 10
Tsmalldate=Replace(Tsmalldate, MyStr(i), i)
next
end function
msgbox Tsmalldate("二○○三年十二月三十一日")
</SCRIPT>
<SCRIPT LANGUAGE=vbs>
'先转换三十一,三十,二十九依次类推,然后再转换其他小于十的
function Tsmalldate(sdate)
Tsmalldate=Trim(sdate)
dim MyStr(10)
MyStr(0)="○":MyStr(1)="一":MyStr(2)="二":MyStr(3)="三":MyStr(4)="四"
MyStr(5)="五":MyStr(6)="六":MyStr(7)="七":MyStr(8)="八":MyStr(9)="九"
MyStr(10)="十"
'先考虑三十一和三十,最大是三十一了,不可能有别的。
Tsmalldate=Replace(Tsmalldate,"三十一","31")
Tsmalldate=Replace(Tsmalldate,"三十","30")
'然后是二十一到二十九内的
for i=1 to 9
if instr(Tsmalldate,"二十" & MyStr(i)) then
Tsmalldate=Replace(Tsmalldate,"二十" & MyStr(i),"2" & i)
end if
next
'然后是二十
Tsmalldate=Replace(Tsmalldate,"二十" ,"20")
'然后是十一到十九的
for i=1 to 9
if instr(Tsmalldate,"十" & MyStr(i)) then
Tsmalldate=Replace(Tsmalldate,"十" & MyStr(i),"1" & i)
end if
next
' 剩下的就是普通数字了
for i=0 to 10
Tsmalldate=Replace(Tsmalldate, MyStr(i), i)
next
end function
msgbox Tsmalldate("二○○三年十二月三十一日")
</SCRIPT>