去掉数组中的重复项

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  0;  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 " ) % >

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值