页面导航: 首页网络编程ASP编程应用技巧 → 正文内容 asp取得数组中的最大值的方法

asp取得数组中的最大值的方法

发布:dxy 字体:[增加 减小] 类型:转载
如何取得数组中的最大值(由71port_80端口提供) 
 该函数的作用是取得一组数组中最大的一个值,非常实用且精典,值得收藏!

snum="345,231,56,786,1100,356,1200,300,685,111,134,765"  
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 
response.Write "数组"&snum&"<br />最大值:"&GetMax(snum) 
浏览次数:载入中... 打印本文关闭本文返回首页

文章评论

共有 位脚本之家网友发表了评论我来说两句

同 类 文 章
最 近 更 新
热 点 排 行