http://zhangbq168.blog.163.com/blog/static/2373530520080249362680/
去掉数组中的重复项
2008-01-24 09:36:02| 分类: .NET - C#|字号 订阅
///
///
去掉数组中的重复项
///
///
///
private
ArrayList
SingleArray(object[]
p_obj_string)
{
ArrayList
l_str_arr=new
ArrayList();
for
(int
i
=
0;
i
<
p_obj_string.Length;
i++)
{
if
(l_str_arr.IndexOf(p_obj_string[i])
==
-1
&&
!p_obj_string[i].Equals(""))
{
l_str_arr.Add(p_obj_string[i]);
}
}
return
l_str_arr;
}
看完这个豁然开朗
js实现
<
%
function
abc(aa) bb
=
split
(aa,
"
,
"
)
for
i
=
0
to
ubound
(bb)
if
i
=
0
then
redim
cc(
0
) cc(
0
)
=
bb(
0
)
else
f
=
true
for
j
=
0
to
ubound
(cc)
if
bb(i)
=
cc(j)
then
f
=
false
exit
for
end
if
next
if
f
=
true
then
redim
preserve cc(
ubound
(cc)
+
1
) cc(
ubound
(cc))
=
bb(i)
end
if
end
if
next
abc
=
join
(cc)
end function
response.write abc(
"
210,112,510,210,112,123
"
) %
>