当前位置: 移动技术网 > IT编程>开发语言>Asp > asp取得数组中的最大值的方法

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

2017年12月12日  | 移动技术网IT编程  | 我要评论
如何取得数组中的最大值(由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) 

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网