導航:首頁 > 凈水問答 > asp過濾重復數組

asp過濾重復數組

發布時間:2021-10-27 17:59:18

㈠ asp 正則 過濾重復字元串的代碼

<%
'過濾重復
Function norepeat(Str)
Dim RegEx
If IsNull(Str) Or Str="" Then Exit Function
Set RegEx=New RegExp
RegEx.Global = True
RegEx.IgnoreCase=True
RegEx.MultiLine = True
RegEx.pattern="(.)\1+"
str=regEx.replace(str,"$1")
Set RegEx=Nothing
Norepeat=str
End Function
'示例
s=""
response.write Norepeat(s)
%>

㈡ ASP如何去重復數據

最好在資料庫讀取的時候就用group by 合並一下,如果不能在資料庫操作只能用數組了!輸出時候遍歷檢索一下重復的不顯示了!

㈢ asp求統計數組里重復元素個數,並求得對應位置的和

dim ArryStr,A,B
ArryStr="a=1|b=1,a=1|b=1,a=1|b=3"
ArryStr=replace(ArryStr,",","|")''先把逗號符替換為|分隔
ArryStr=Split(ArryStr,"|")''分割為數組
For I=0 to Ubound(ArryStr)

if instr(ArryStr(I),"a=")>0 then
A=A+Split(ArryStr(I),"=")(1)
end if
if instr(ArryStr(I),"b=")>0 then
B=B+Split(ArryStr(I),"=")(1)
end if
Next
Response.write "a="&A
Response.write "<br />"
Response.write "b="&B

㈣ asp 數組判斷含有重復數據

TYHT TYUT

㈤ asp如何過濾access資料庫同一欄位中重復的數據

你的數據表有沒有設置無重復的主鍵欄位呢(比如ID)?如果有就好辦:
rs.open "select * from 表名 where id in (select min(id) from 表名 group by 有重復的欄位名)",conn,1,1
如果沒有這樣的欄位,也可以用其他在所有記錄都無重復(或者說具有唯一性)的欄位來代替,如果連這也沒有就麻煩一些了,需要分多步來篩選了。

㈥ ASP 如何判斷數組有無重復

Function FormateOrderBy(OrderByText)
Dim tmp,tmp2,i,j
tmp3 = ""
tmp = Split(OrderByText," ")
For i=0 To Ubound(tmp)-1
For j=i+1 To Ubound(tmp)
If UCase(Trim(tmp(i)))=UCase(Trim(tmp(j))) Then
tmp(j)=""
End If
Next
Next
tmp2=""
For i=0 To Ubound(tmp)
If tmp(i) <>"" Then tmp2 = tmp2 & tmp(i) & " "
Next
FormateOrderBy = Left(tmp2,Len(tmp2)-1)
End function

㈦ 怎樣過濾數組中重復的數據

在php中函數array_unique的功能是移除數組中重復的值。

㈧ asp怎樣過濾重復的片語

試試這個函數

<%
Dims
s="中國,美國,法國,義大利,美國,澳大利亞,中國,澳大利亞,泰國"
response.writedelR(s)

FunctiondelR(ByValstr)
Dimarr,b(),i,j,k,sf
arr=Split(str,",")
ReDimb(k):b(k)=arr(0)
Fori=1ToUBound(arr)
sf=False
Forj=0ToUBound(b)
Ifb(j)=arr(i)Then
sf=True
ExitFor
EndIf
Next
Ifsf=FalseThen
k=k+1
ReDimPreserveb(k)
b(k)=arr(i)
EndIf
Next
delR=Join(b,",")
EndFunction
%>

㈨ ASP如何過濾數組內重復內容

dim a(4)
a(0)=1
a(1)=1
a(2)=2
a(3)=2
a(4)=3
for n=0 to ubound(a)-1
for s=1 to ubound(a)

if a(s)=a(n) then
a(n)=""

end if
next

next
a_new=filter(a,"")『把a數組裡面是空值的全部刪掉,然後重新組合成一個a_new數組。
for n=0 to ubound(a_new)』列印出a_new數組。
response.write a_new(n)&"<br>"

next

說明:a_new是新生成的數組,去掉了a數組裡面被清空的那些,重新生成了一個開頭角標是0的a_new數組。

㈩ ASP過濾重復數據

1、同一個電話號碼分機不同只記錄一個(改SQL語句,有些細節我忘記了,LZ試試吧):
strsql="select * from sit where mid(dhhm,0,11) ='" & mid(dhhm,0,11) & "'"

strsql="select * from sit where dhhm like '" & mid(dhhm,0,11) & "%'"
strsql="select * from sit where dhhm like '" & mid(dhhm,0,11) & "*'"
2、還有個別號碼不記錄:
if rst.eof then
改成:
if rst.eof and (instr(dhhm,"0598")>0 or instr(dhhm,"0591")>0) then
應該沒問題了

上面的是代碼結構比較好
改下 提高運行效率的
if instr(dhhm,"0598")>0 or instr(dhhm,"0591")>0 then '過濾不要記錄確定需要再打開記錄集

set rst=server.CreateObject("adodb.recordset")
strsql="select * from sit where dhhm ='" & dhhm & "'"
rst.open strsql,my_conn,1
if rst.eof then
sql="Insert Into sit (dhhm,CreatTime,Inform) values ('"&dhhm&"','"&Times&"','"&Inform&"')"
my_Conn.execute(sql)
end if
set my_conn=nothing
end if

end if

閱讀全文

與asp過濾重復數組相關的資料

熱點內容
氯性陰離子交換樹脂使用方法 瀏覽:990
普拉多2700換什麼空氣濾芯 瀏覽:493
怎麼判斷地暖濾芯堵不堵 瀏覽:966
鄭州污水井蓋多少錢 瀏覽:816
高級氧化廢水處理實驗 瀏覽:824
青島污水提升器代理公司 瀏覽:368
純凈水有什麼成分組成 瀏覽:679
純水機噸數什麼意思 瀏覽:431
處理含有硫酸污水 瀏覽:514
小米凈化器怎麼總顯示001 瀏覽:460
濟南純水機多少錢一台 瀏覽:211
純水機接頭4042是什麼 瀏覽:687
污水處理廠屬於什麼設施用地 瀏覽:774
空氣凈化器都有什麼作用 瀏覽:22
底燒瓶蒸餾燒瓶 瀏覽:795
用什麼樣的凈水器好 瀏覽:122
什麼工廠產生硫酸廢水 瀏覽:25
阿克薩納有水垢 瀏覽:130
凈水機濾芯什麼材料最好 瀏覽:338
dna在蒸餾水中易溶解 瀏覽:181