469,622 Members | 1,548 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,622 developers. It's quick & easy.

Comparison help...suggestions

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


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #1
2 1104

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?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #2
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>"

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

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Bill W. | last post: by
2 posts views Thread by Dave | last post: by
reply views Thread by Tim Brooks | last post: by
6 posts views Thread by Tom Kelleher | last post: by
43 posts views Thread by michael.f.ellis | last post: by
4 posts views Thread by almurph | last post: by
7 posts views Thread by bcutting | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.