Help with exact string comparison

Discussion in 'ASP General' started by Joey Martin, Mar 3, 2009.

  1. Joey Martin

    Joey Martin Guest

    I'll try to be as detailed as possible.

    I have a string:

    totalx="12345,5642,6610,3340"

    I have large list of check boxes. The value is being pulled from a
    database and dynamically generated.

    <option type=checkbox value=3333 name=theid>
    <option type=checkbox value=5642 name=theid>
    <option type=checkbox value=9001 name=theid>

    I need each line of checkboxes to compare their value to the string
    above. And, if they match exactly I need " checked " written to them.

    How do I do this? I tried INSTR but the problem is that if I have
    <option type=checkbox value=45 name=theid> then it checkmarks that box
    since the value 45 can be found in my string. But, they need to be exact
    matches.

    Thanks in advance for the help.



    *** Sent via Developersdex http://www.developersdex.com ***
     
    Joey Martin, Mar 3, 2009
    #1
    1. Advertising

  2. Joey Martin

    Evertjan. Guest

    Joey Martin wrote on 03 mrt 2009 in
    microsoft.public.inetserver.asp.general:

    > I'll try to be as detailed as possible.
    >
    > I have a string:
    >
    > totalx="12345,5642,6610,3340"
    >
    > I have large list of check boxes. The value is being pulled from a
    > database and dynamically generated.
    >
    > <option type=checkbox value=3333 name=theid>
    > <option type=checkbox value=5642 name=theid>
    > <option type=checkbox value=9001 name=theid>
    >
    > I need each line of checkboxes to compare their value to the string
    > above. And, if they match exactly I need " checked " written to them.
    >
    > How do I do this? I tried INSTR but the problem is that if I have
    > <option type=checkbox value=45 name=theid> then it checkmarks that box
    > since the value 45 can be found in my string. But, they need to be exact
    > matches.



    add two commas to the sting:

    totalx = "12345,5642,6610,3340"
    s1 = "," & totalx & ","

    and add them to the checkbox value too:

    s2 = "," & myChkbxVal & ","

    now do an instr() s2 in s1


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Mar 3, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. alberto

    knowing exact string array length ?

    alberto, Jun 17, 2006, in forum: C Programming
    Replies:
    26
    Views:
    685
    CBFalconer
    Jun 19, 2006
  2. Replies:
    21
    Views:
    706
    Pete Becker
    Apr 13, 2006
  3. Mark Findlay

    RegExp: How to match on exact string only?

    Mark Findlay, May 14, 2004, in forum: Javascript
    Replies:
    6
    Views:
    157
    Steve van Dongen
    May 16, 2004
  4. sivga

    reg exact string matching

    sivga, Nov 2, 2006, in forum: Perl Misc
    Replies:
    3
    Views:
    88
    Mumia W. (reading news)
    Nov 2, 2006
  5. Deepu
    Replies:
    1
    Views:
    244
    ccc31807
    Feb 7, 2011
Loading...

Share This Page