String not recogized as array

Discussion in 'ASP General' started by gil, Aug 24, 2004.

  1. gil

    gil Guest

    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?
    gil, Aug 24, 2004
    #1
    1. Advertising

  2. I have a suggestion. Show us your code.

    Ray at home

    "gil" <> wrote in message
    news:...
    > 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?
    >
    >
    Ray Costanzo [MVP], Aug 24, 2004
    #2
    1. Advertising

  3. gil

    Mark Schupp Guest

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

    --
    Mark Schupp
    Head of Development
    Integrity eLearning
    www.ielearning.com


    "gil" <> wrote in message
    news:...
    > 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?
    >
    >
    Mark Schupp, Aug 24, 2004
    #3
  4. gil

    gil Guest

    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

    >>>>> Which generates "66.134.64.153", "66.134.64.153", "22.15.41.117"



    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



    "gil" <> wrote in message
    news:...
    > 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?
    >
    >
    gil, Aug 25, 2004
    #4
  5. gil

    gil Guest

    I got it. Had to split my string and lose the array() function.


    Thanks



    "gil" <> wrote in message
    news:...
    >
    > 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
    >
    > >>>>> Which generates "66.134.64.153", "66.134.64.153", "22.15.41.117"

    >
    >
    > 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
    >
    >
    >
    > "gil" <> wrote in message
    > news:...
    > > 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?
    > >
    > >

    >
    >
    gil, Aug 25, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UmFqZXNoIHNvbmk=?=

    'System.String[]' from its string representation 'String[] Array'

    =?Utf-8?B?UmFqZXNoIHNvbmk=?=, May 4, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    1,786
    =?Utf-8?B?UmFqZXNoIHNvbmk=?=
    May 4, 2006
  2. ankur
    Replies:
    1
    Views:
    12,700
    Jan =?UTF-8?B?VGhvbcOk?=
    Aug 27, 2007
  3. Mara Guida

    const and array of array (of array ...)

    Mara Guida, Sep 2, 2009, in forum: C Programming
    Replies:
    3
    Views:
    472
    David RF
    Sep 3, 2009
  4. Tom
    Replies:
    3
    Views:
    197
    salsablr
    Dec 20, 2004
  5. Tuan  Bui
    Replies:
    14
    Views:
    462
    it_says_BALLS_on_your forehead
    Jul 29, 2005
Loading...

Share This Page