'345,231,56,786,1100,356'返回最大值

asp函数

2008-06-11 10:32

'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)