How to get the maximum value in an array (provided by port 71port_80)
The function of this function is to obtain the largest value in a set of arrays. It is very practical and classic, and worth collecting!
The code copy is as follows:
snum="345,231,56,786,1100,356,1200,300,685,111,134,765"
functionGetMax(str)
num=split(str,",")
max=num(0)
forii=0toubund(num)
ifcint(num(ii))>cint(max)thenmax=num(ii)
response.Write"num="&num(ii)&",max="&max&"<br/>"
next
GetMax=max
endfunction
response.Write"array"&snum&"<br/>Maximum value:"&GetMax(snum)
Articles that may be of interest to you:
Asp, the code that uses an array to store data in asp to obtain the number of elements in a dynamic array asp.net Several ways to replace strings in an array asp Dynamic array provides Add, Insert, Remove, RemoveAt, Search and other methods. asp.net string, binary, encoded array conversion function asp.net code to create cookies and clear cookie arrays through js asp textarea multi-line array segmentation processing method asp array duplicate function (wrong new webmaster site enhanced version) ASP filter array duplicate data function (enhanced version) ASP implementation code to retrieve array implementation code introduction to array and array and string subscript of Asp and JS introduction tips for creating dynamic array instances in asp ASP