Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Array

Status
Not open for further replies.

patriciaxxx

Programmer
Jan 30, 2012
277
GB
I have the following code which stores the string variable MyText in an array. The code works.

Code:
    Set ADOStream = CreateObject("ADODB.Stream")
    With ADOStream
        .Charset = "utf-8": .Mode = 3: .Type = 2: .Open
        .WriteText MyText: .Flush: .Position = 0
        .Type = 1: .Read 3: ByteArrayToEncode = .Read(): .Close
    End With

    For i = 0 To UBound(ByteArrayToEncode)
        iAsc = ByteArrayToEncode(i)
        Select Case iAsc
            Case 32: sTemp$ = "+"
            Case 48 To 57, 65 To 90, 97 To 122: sTemp$ = Chr(ByteArrayToEncode(i))
            Case Else: sTemp$ = "%" & Hex(iAsc)
        End Select
        txt$ = txt$ & sTemp$
    Next

The following code writes the data from XMLHTTP.responseBody to a text file called MyText which is then returned in the function named MyFunction

Please can someone show me how to change this so that it uses an array and not a text file?

Code:
        With ADOStream
            .Type = 1: .Open: .Write XMLHTTP.responseBody
            .SaveToFile LocalPath, 2
            .Close: .Type = 2: .Charset = "utf-8": .Open:
            .LoadFromFile MyText
            MyFunction = .ReadText
        End With
 
What exactly are you looking to get with your array? Just basically one column, maybe with each separate value being one "word"? If so, could you simply use the SPLIT function, and use the space character as the delimiter?

"But thanks be to God, which giveth us the victory through our Lord Jesus Christ." 1 Corinthians 15:57
 
Patricia can you explain what it is you are actually trying to do. In the first instance it looks like you are just using the stream to create the array. And you are only using the array so that it can be used to create an encoded string.

So we need a better understanding of what is going on here before providing advice on how to proceed.
 
(given that there are some pretty direct methods of canonicalizing HTML strings, which is what seems to be the goal here)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top