ASP取得计算数字!

来源:百度知道 编辑:UC知道 时间:2024/06/05 09:47:00
我要做ASP一套程序,用户输入一套11位数字,除以“1.71314”,在得出的结果中,截取小数点后面的第9位(包括第九位)向左的数字。去除相同的数字,例如123.2234565,得数应该是123456。
然后把得数中,从右往左的选择4位数,并显示出来。

<%
num=12345678910
str=num/1.71314

str=left(str,instr(str,".")+9) '取小数点后第9位
str=replace(str,".","") '去除小数点

'去除相同的数字
temp=""
for i=1 to len(str)
s=mid(str,i,1)
if instr(temp,s)=0 then
temp=temp+s
end if
next

str=right(temp,4) '输出右边四位数
Response.Write(str) '输出显示
%>