<SCRIPT LANGUAGE="VBScript">
<!--
function getarr(thestr,str)
strarr = split(str,";")
tempstr = ""
for i=0 to ubound(strarr)
if instr(strarr(i),",") then
if instr(","&thestr&",",","&split(strarr(i),",")(0)&",")>0 then
tempstr = tempstr&strarr(i)&";"
end if
end if
next
getarr = tempstr
end function
function getMaxarr(str)
strarr = split(str,";")
tempn = 0
tempstr = ""
for i=0 to ubound(strarr)
if instr(strarr(i),",") then
if int(split(strarr(i),",")(1))>tempn then
tempn = int(split(strarr(i),",")(1))
tempstr = strarr(i)
end if
end if
next
getMaxarr = tempn
end function
msgbox getMaxarr(getarr("1,2,5,6,11,","2,3;5,3;12,3;13,3;8,5;6,3;11,2;10,2;1,4;"))
//-->
</SCRIPT>
<%
'一个字符串:2,5,6,11,
'另一个是这样的:2,3;5,3;12,3;13,3;8,5;6,3;11,2;10,2;1,4;
'如何取出:2,3;5,3;6,3;11,2;
Function GetUserPermission(UserID,Permission)
dim ArrayForOneStr,ArrayForTwoStr,strForResult
dim i,j
i = 0
j = 0
strForResult = ""
ArrayForOneStr = ","&UserID
ArrayForTwoStr = split(Permission,";")
for i = 0 to ubound(ArrayForTwoStr)
if instr(1,ArrayForTwoStr(i),",") then
if instr(1,ArrayForOneStr,","&split(ArrayForTwoStr(i),",")(0)&",") then
strForResult = strForResult & split(ArrayForTwoStr(i),",")(1) & ";"
end if
end if
next
GetUserPermission = mid(strForResult,1,len(strForResult)-1)
End Function