asp 过滤数组重复数据

function array_no(cxstr1,cxstr2,cxstr3)
if len(cxstr3) > 0 then
if not IsNumeric(cxstr3) then
array_no = "对不起,参数3类型必需为数字"
Exit Function
end if
else
array_no = "对不起,参数3类型必需为数字"
Exit Function
end if
if isarray(cxstr1) then
array_no = "对不起,参数1不能为数组"
Exit Function
end if
if cxstr1 = "" or isempty(cxstr1) then
array_no = "没有数据"
Exit Function
end if
ss = split(cxstr1,cxstr2)
cxs=cxstr2&ss(0)&cxstr2
sss=cxs
for m = 0 to ubound(ss)
cc = cxstr2&ss(m)&cxstr2
if instr(sss,cc)=0 then
sss = sss&ss(m)&cxstr2
end if
next
array_no = right(sss,len(sss)-len(cxstr2))
array_no = left(array_no,len(array_no)-len(cxstr2))
if cxstr3 <> 0 then
cx_sp = split(array_no,cxstr2)
if cxstr3 > ubound(cx_sp) then
array_no = cx_sp(ubound(cx_sp))
else
array_no = cx_sp(cxstr3)
end if
end if
end function%>

时间: 2024-08-03 04:55:30

asp 过滤数组重复数据的相关文章

ASP 过滤数组重复数据函数(加强版)_javascript技巧

函数代码: 复制代码 代码如下: <%'******************************************************* '过滤数组重复函数名称:array_no(cxstr1,cxstr2,cxstr3) 'cxstr1:任意的字符串,自动识别 'cxstr2:cxstr1中分割符号. 'cxstr3:提取结果中的某一位置字串,等于0时返回为全部,大于数组下标时返回最后. '使用于二维数组 '************************************

js过滤数组重复元素的方法_javascript技巧

复制代码 代码如下: function filterArray(str,array){ //此函数为过滤数组中重复的元素,并不允许插入空值,函数返回数组 var isnull = false; if(str == "" || str == null || str == 'undefined'){ isnull = true; } var newnum = 0; var newarray = []; var num = array.length; if(num == 0){ if(!is

php array_unique 去除数组重复数据

今天看到一个正则文章的地址时,发现了array_unique函数,开始不知道他的作用经过查找后发现,他是是去了数组中重复的数据哦, 下面来看看array_unique语法: array_unique(array()); 看看实例 $body =" array('key'=>'PRODUCT', 'name'=>'1231管理'),<img src=http://www.11.cn/banner.gif />现来中城<img src=https://yunqi-tec

javascript下过滤数组重复值的代码_javascript技巧

<script language="javascript">    function getNoRepeat() {        return arguments[0].join('|').match(/(\b[^|]+\b)(?!.*|\1\b)/ig);    }    var tmpArr = [1, 'a', 'ab', 'abc', 'd', 1.2, 'a+b', 'd', 'e', 5, 'a', 1, 'h', 'c', 'ab'];    var ret

JS求多个数组的重复数据_java

今天朋友问了我这个问题:JS求多个数组的重复数据  注:1.更准确的说是只要多个数组中有两个以上的重复数据,那么这个数据就是我需要的 2.单个数组内的数据不存在重复值(当然如果有的话,你可以去重) 3.耗时问题,这一点很重要  源代码:  <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>获取多个数组中的重复数据<

java使用Hashtable过滤数组中重复值的方法_java

本文实例讲述了java使用Hashtable过滤数组中重复值的方法.分享给大家供大家参考,具体如下: package org.eline.core.web.support; import java.util.Hashtable; /***************************** * * @author zdw * */ public class ObjectFilter { public static void main(String[] args) { // String 测试 S

PHP两种去掉数组重复值的方法比较_php实例

去除一个数组中的重复值,可以使用foreach方法,也可以使用array_unique方法,下面的代码两种方法都使用了. <?php $arrF = array(); $arrS = array(); $intTotal = 100; $intRand = 10; for($i=0; $i < $intTotal; $i++) { $arrF[] = rand(1, $intRand); $arrS[] = rand(1, $intRand); } $arrT = array_merge($a

asp.net 获取数组中重复数据代码

asp教程.net 获取数组中重复数据代码 下面提供了五款不同方法的取出数据中重复的数据并统计重复的次数. dictionary<int, int> dic = new dictionary(); int[] arr = new int[] { 1, 5, 2, 6, 7, 1, 5, 4, 1, 6, 8, 7, 6 }; foreach(int i in arr) {   try   {   dic.add(i, i);   }   catch(exception err)   {   /

sql过滤重复数据几种方法

在开发中经常会碰到关于有重复记录的数据,我们重想办法来过滤一些重复的记录,下面我总结了几种方法,希望对大家有用. 方法一,   select identity(int,1,1) as id,* into #temp from tabel select * from #temp where id in ( select max(id) from #emp where having count(*)>1 group by col1,col2,col3...) 实例 有一个表的结构是这样的