28,406
社区成员
发帖
与我相关
我的任务
分享
<%
s = "1,1,2,2,2"
a = Split(s,",")
Set d = CreateObject("Scripting.Dictionary")
For i=0 To UBound(a)
If d.Exists("_" & a(i)) Then
d.Item("_" & a(i)) = CDbl(a(i)) + d.Item("_" & a(i))
Else
d.Add "_" & a(i), CDbl(a(i))
End If
Next
k = d.Keys()
For i=0 To UBound(k)
n = Right(k(i), Len(k(i))-1)
Response.Write n & "=" & d(k(i)) & "<br>"
Next
%>