CSDN论坛里的一些问题真的是,难怪有人不屑一顾。
http://community.csdn.net/Expert/topic/3446/3446414.xml?temp=.1328546
真不知道CSDN是在教人还是在害人,看看后面的回答就知道了,另附上我的回答。
dim strmsg
strmsg="65.5/65.5/62.5/65.5/61/68.5/68/66.5/65.5/65/65/69/72.5/73/78/80/67/73/70/83/65.5/63/66.5/69/72/71/70/73/67.5/70.5/67.5/68.5/69/68/68/68.5/69/69.5/68.5/67.5/68.5/76/68"
dim theArray
theArray = split(strmsg, "/")
dim dictionary
set dictionary = CreateObject("Scripting.Dictionary")
for i = 0 to UBound(theArray)
if dictionary.Exists(theArray(i)) Then
dictionary(theArray(i)) = dictionary(theArray(i)) + 1
else
dictionary.add theArray(i), 1
end if
next
for i = 0 to dictionary.Count - 1
document.write(i & ": value = " & dictionary.Keys()(i) & ", count = " & dictionary(dictionary.Keys()(i)) & "<br>")
next
strmsg="65.5/65.5/62.5/65.5/61/68.5/68/66.5/65.5/65/65/69/72.5/73/78/80/67/73/70/83/65.5/63/66.5/69/72/71/70/73/67.5/70.5/67.5/68.5/69/68/68/68.5/69/69.5/68.5/67.5/68.5/76/68"
dim theArray
theArray = split(strmsg, "/")
dim dictionary
set dictionary = CreateObject("Scripting.Dictionary")
for i = 0 to UBound(theArray)
if dictionary.Exists(theArray(i)) Then
dictionary(theArray(i)) = dictionary(theArray(i)) + 1
else
dictionary.add theArray(i), 1
end if
next
for i = 0 to dictionary.Count - 1
document.write(i & ": value = " & dictionary.Keys()(i) & ", count = " & dictionary(dictionary.Keys()(i)) & "<br>")
next