asp数组去重复和数组排序
时间:2008-10-30 12:51:00
数组去重复和数组排序
'数组名次
Function Sort(ary,stra)
KeepChecking = TRUE
Do Until KeepChecking = FALSE
KeepChecking = FALSE
For i = 0 to UBound(ary)
If i = UBound(ary) Then Exit For
If CDbl(ary(i))<CDbl(ary(i+1)) Then
FirstValue = CDbl(ary(i))
SecondValue = CDbl(ary(i+1))
ary(i) = SecondValue
ary(i+1) = FirstValue
KeepChecking = TRUE
End If
Next
Loop
sort=0
For j=0 To UBound(ary)
If CDbl(ary(j))=CDbl(stra) Then
Sort=j+1
End If
Next
End Function
将字符串数组去掉重复项
Function clearrepeat(arrstr)
For k=0 To UBound(arrstr)
If k=0 Then
arr=arrstr(k)
Else
arr=arr&","&arrstr(k)
End If
Next
Dim tmp,tmp2,i,j
tmp3=""
tmp=Split(arr,",")
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
clearrepeat=Split(Left(tmp2,Len(tmp2)-1),",")
End Function
Function arrSort(ary,stra)
KeepChecking = TRUE
Do Until KeepChecking = FALSE
KeepChecking = FALSE
For i = 0 to UBound(ary)
If i = UBound(ary) Then Exit For
If CDbl(ary(i))<CDbl(ary(i+1)) Then
FirstValue = ary(i)
SecondValue = ary(i+1)
ary(i) = SecondValue
ary(i+1) = FirstValue
KeepChecking = TRUE
End If
Next
Loop
arrsort=ary
End Function
标签:数组,排序,字符串,asp
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
SQL Server管理 这些你懂吗?
2011-07-01 13:40:23
![](https://img.aspxhome.com/file/UploadPic/20117/201171121934545s.png)
oracle 查询表名以及表的列名
2009-07-26 09:33:00
比较SQL Server约束和DML触发器
2008-12-24 15:54:00
一个滑动门菜单例子源码
2007-12-31 10:16:00
[原创][分享]数字格式化转换
2011-07-04 12:20:15
CSS注意事项: 针对 Safari(WebKit)
2008-10-29 11:57:00
从品牌网站看交互设计
2009-08-18 12:39:00
![](https://img.aspxhome.com/file/UploadPic/20098/18/1-31s.jpg)
asp如何实现歌曲在线点播?
2010-05-19 21:32:00
MySQL 5.0 数据库新特性的存储过程
2007-10-24 19:45:00
css学习笔记: css新闻列表的特殊做法
2009-07-19 14:25:00
![](https://img.aspxhome.com/file/UploadPic/20097/19/11e89610908g215-71s.jpg)
一种有创意的CSS命名规则
2008-06-15 15:18:00
MySQL Order By用法
2011-01-04 19:50:00
MySQL安全问题的一点心得
2009-01-07 16:13:00
[奇招] JS暴虐查找算法
2008-07-06 21:17:00
asp如何获知Connection对象更多的信息?
2009-11-23 20:53:00
用纯CSS3绘制的网站图标
2010-03-28 13:51:00
![](https://img.aspxhome.com/file/UploadPic/20103/28/css-social-media-icons-65s.png)
ASP获取当前页面URL地址(带参数)的方法
2010-01-14 19:40:00
解决oracle用户连接失败的解决方法
2011-01-04 19:35:00
使用SSIS创建同步数据库数据任务的方法
2012-11-30 19:53:44
![](https://img.aspxhome.com/file/UploadPic/201211/30/20121130203644808s.png)
SQL Server如何实现快速删除重复记录?
2011-05-03 11:18:00
![](https://img.aspxhome.com/file/UploadPic/20115/3/0958240-66s.jpg)