Comparison help...suggestions

J

Joey Martin

I have results from a database for the ROOMS field that look something
like this:
Dining,Master,FormalDining

I need some comparison help BUT without creating an array. I really need
someone like:
if rs("rooms") LIKE "dining" then DINING="YES" end if

I know you can't use the LIKE command this way.

If this is not possible without an array, then how do I do this in an
array? My current code would be:
roomarray=rs("ROOMS")
roomsplit=split(roomarray,",")
For i = 1 to UBound(allsplit)
**What would go here for the comparison?
Next
 
J

Joey Martin

Ok. So I have decided to use the SPLIT method.
Here is what I have for testing:

energyarray="heat,ac,gas"
energysplit=split(energyarray,",")
For iLoop=0 to UBound(energysplit)-1
Response.write "<li>" & energysplit(iLoop) & "</li>"
Next


GAS is not being displayed. I assume because there is no comma after it.
So, how do I fix this so all of them are displayed?
 
E

Evertjan.

Joey Martin wrote on 20 dec 2003 in
microsoft.public.inetserver.asp.general:
Ok. So I have decided to use the SPLIT method.
Here is what I have for testing:

energyarray="heat,ac,gas"
energysplit=split(energyarray,",")
For iLoop=0 to UBound(energysplit)-1
Response.write "<li>" & energysplit(iLoop) & "</li>"
Next


GAS is not being displayed. I assume because there is no comma after
it. So, how do I fix this so all of them are displayed?

Ubound gives the top index, not the arraylength like in Javascript.

Your string is a comma delimited list, the split makes an array:

============================


'' Set Response = document '' for clientside IE test use

energylist="heat,ac,gas"
energyarray=split(energylist,",")

Response.write "UBound(energyarray) = " & UBound(energyarray)
Response.write "<ol>"
For iLoop=0 to UBound(energyarray)
Response.write "<li>" & energyarray(iLoop) ''' & "</li>"
Next
Response.write "</ol>"

=============================
 

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

Forum statistics

Threads
474,141
Messages
2,570,817
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top