如何取得數組中的最大值(由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)
您可能感興趣的文章:- asp下使用數組存放數據的代碼
- asp 得到動態數組中元素的個數
- asp.net 數組中字符串替換的幾種方式
- asp 動態數組 提供Add、Insert、Remove、RemoveAt、Search等方法。
- asp.net 字符串、二進制、編碼數組轉換函數
- asp.net通過js實現Cookie創建以及清除Cookie數組的代碼
- asp textarea 多行數組分割處理方法
- asp 數組 重復刪除函數(腳本之家增強版)
- ASP 過濾數組重復數據函數(加強版)
- ASP 使用Filter函數來檢索數組的實現代碼
- asp數組的使用介紹
- Asp與JS的數組和字符串下標介紹
- asp中使用redim、preserve創建動態數組實例
- ASP定義數組方法的技巧