Comparison help...suggestions

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joey Martin

    #1

    Comparison help...suggestions

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

    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("R OOMS")
    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!
  • Joey Martin

    #2
    Re: Comparison help...suggesti ons


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

    energyarray="he at,ac,gas"
    energysplit=spl it(energyarray, ",")
    For iLoop=0 to UBound(energysp lit)-1
    Response.write "<li>" & energysplit(iLo op) & "</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!

    Comment

    • Evertjan.

      #3
      Re: Comparison help...suggesti ons

      Joey Martin wrote on 20 dec 2003 in
      microsoft.publi c.inetserver.as p.general:
      [color=blue]
      > Ok. So I have decided to use the SPLIT method.
      > Here is what I have for testing:
      >
      > energyarray="he at,ac,gas"
      > energysplit=spl it(energyarray, ",")
      > For iLoop=0 to UBound(energysp lit)-1
      > Response.write "<li>" & energysplit(iLo op) & "</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?
      >[/color]

      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="hea t,ac,gas"
      energyarray=spl it(energylist," ,")

      Response.write "UBound(energya rray) = " & UBound(energyar ray)
      Response.write "<ol>"
      For iLoop=0 to UBound(energyar ray)
      Response.write "<li>" & energyarray(iLo op) ''' & "</li>"
      Next
      Response.write "</ol>"

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

      --
      Evertjan.
      The Netherlands.
      (Please change the x'es to dots in my emailaddress)

      Comment

      Working...