I am hoping to learn how to create an array from a database query, and then search the array for the position of the first occurence of a specific integer. I have done this successfully using InStr but I was wondering if it is possible in this manner...
<% Dim strValue strValue = rs2("COC") Dim myArray myArray = split(strValue,";") Dim returnValue returnValue = Array.Find(myArray, 17) Response.Write(returnValue) %>
First I dimension strValue and set it to a database queried value of rs("COC") which is the following string...
Then I split the string using ; as my separator, and I get this...
the next bit of code is where I am sure I trip up; the Array.find(myArray, 17)
Does this search myArray for the position of the first occurence of 17? Or am I understanding this wrong?
Also, is there a way to replace the semicolons with commas before I perform the split?
Thanks for any help!
This post has been edited by midasxl: 25 March 2009 - 09:05 AM