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


如何取得数组中的最大值(由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)

—-想了解更多的linux相关异常处理怎么解决关注<计算机技术网(www.ctvol.com)!!>



本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

ctvol管理联系方式QQ:251552304

本文章地址:https://www.ctvol.com/htmltutorial/77706.html

(0)
上一篇 2020年4月22日
下一篇 2020年4月22日

精彩推荐