• 主页

100分求：二维数组的最大值，星级高手请进！正确答案立刻揭贴！

lawdoor 2004-04-02 11:53:25

user_id groups
1 2,3,4,8,11,.....,9,

part_id group_right
4 4,2;5,2;7,4;11,5; (组ID,组权限；)

...全文
67 点赞 收藏 38

38 条回复

cjf1009 2004-04-03

opolmzy 2004-04-02
dim id
id=split(rs("group_right"),';')

id_d=split(id,',')

51windows 2004-04-02

xxrl 2004-04-02

kining 2004-04-02

51windows 2004-04-02

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

nchen123 2004-04-02

bingbingcha 2004-04-02

xxrl 2004-04-02
<%
'一个字符串：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

OneStr = "2,5,6,11,"
TwoStr = "2,3;5,3;12,3;13,3;8,5;6,3;11,2;10,2;1,4;"

response.Write GetUserPermission(OneStr,TwoStr)
%>

lawdoor 2004-04-02
'一个字符串a：1,2,5,6,11,
'另一个是这样的b：2,3;5,3;12,3;13,3;8,5;6,3;11,2;10,2;1,4;

pizixt 2004-04-02

51windows 2004-04-02

2,3,4＝》，2,3,4，

3,=>,3,

instr(",2,3,4,",",3,")

lawdoor 2004-04-02
xxrl(孔曰成仁,孟曰取E)

nchen123 2004-04-02

InStr 函数返回以下值：

string1 为零长度 0
string1 为 Null Null
string2 为零长度 start
string2 为 Null Null
string2 没有找到 0

start > Len(string2) 0

nchen123 2004-04-02

if instr("aaaaaffsdfsd", "f") then

if instr("aaaaaffsdfsd", "f") = 1 then

lawdoor 2004-04-02

xxrl 2004-04-02
51windows(海娃) 你一开始贴出来的代码没有考虑1，和11，的那种

51windows 2004-04-02

2,3,4＝》，2,3,4，

3,=>,3,

instr(",2,3,4,",",3,")

xxrl 2004-04-02
51windows(海娃) 的好像不正确

lawdoor 2004-04-02

ASP

2.8w+

ASP即Active Server Pages，是Microsoft公司开发的服务器端脚本环境。