We help IT Professionals succeed at work.
Get Started

Dynamic Array Not Responding

Naryan108
Naryan108 asked
on
252 Views
Last Modified: 2012-05-05
Hi, I am looping though a string and need to put every instance of the substring into an array to be dealt with later.  I don't know how many elements the array will hold, so I start reDim it as part of the loop.  However, although my quick tests using reponse.write show that I am getting the right info, I can't seem to put them into the array.  That is, when I come to test the array there's nowt in there.

I know there's shorter ways of writing this, but I'm just getting it clear in my head first.

Any help would be a Big help.
dim strLen, strPos, varPos, varArray
dim strArray()
 
strLen = Len(strHTML)
varPos = 1
varArray = 0
Do while varPos < strLen
	Redim strArray(varArray)
	strPos = instr(varPos, strHTML, "prod", 1)
	If strPos = 0 then exit do
	strArray(varArray) = mid(strHTML, strPos + 4, 2)
	'response.Write(mid(strHTML, strPos + 4, 2))
	'response.write("<br />")
	varPos = strPos + 6
	varArray = varArray + 1
Loop
'response.Write(strArray(1))
 
For Each product In strArray
response.write(product)
response.write("<br />")
Next

Open in new window

Comment
Watch Question
Senior Solution Architect
Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE