当前位置:编程学习 > asp >>

asp实现取得数组中的最大值的代码

答案: <%
'******************************
'函数:GetMax(str)
'参数:str,待处理的数字数组,以,分隔多了数字
'作者:阿里西西
'日期:2007/7/12
'描述:取得数组中的最大值
'示例:<%=GetMax("360,120,5,600,32")%>
'******************************
function GetMax(str)
num=split(str,",")
max=num(0)
for ii=0 to ubound(num)
if cint(num(ii))>cint(max) then max=num(ii)
response.write "num="&num(ii)&",max="&max&"<br />"
next
getmax=max
end function
%>

上一个:用ASP生成UTF-8网页文件的两种方法
下一个:解决采集时出现msxml3.dll 错误的方法

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,