String not recogized as array

G

gil

If I use a literal string:

theArray = Array("66.134.63.152", "66.134.63.152", "24.15.41.147")

the arguments "theArray" works fine in my function.

If I build my array with a for next my function (guessing) sees my argument
as a string. I have printed
out both values and they are exactly the same in appearance.

Any suggestions?
 
M

Mark Schupp

It is not clear what your question is. Please post the code, the input
values, and the output that you feel is incorrect.
 
G

gil

I'm parsing IIS logs and trying to weed out duplicates.


This part is wrapped inside of a for each:

If FieldName = "c-ip" Then
If i = UBound(splitline) - 1 Then
myDivider = """"
Else
myDivider = """, "
End If
iparray = iparray & """" &
SpaceSplit(PlaceValue - 1) & myDivider
End If


If FieldName = "c-ip" Then
theArray = Array("66.134.64.153", "66.134.64.153", "22.15.41.117")
theArray = RemDups(theArray)
Text3 = ""
Text3 = ShowArray(theArray)
End If


Function ShowArray(ByVal arr)
Dim item, s
For Each item In arr
s = s & item & vbCrLf
Next
ShowArray = s
End Function

Function RemDups(ByVal anArray)
Dim d, item, thekeys

Set d = CreateObject("Scripting.Dictionary")
d.removeall
d.CompareMode = 0
For Each item In anArray
If Not d.Exists(item) Then d.Add item, item
Next
thekeys = d.keys
Set d = Nothing
RemDups = thekeys
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,831
Latest member
HealthSmartketoReviews

Latest Threads

Top