Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Help with exact string comparison

Reply
Thread Tools

Help with exact string comparison

 
 
Joey Martin
Guest
Posts: n/a
 
      03-03-2009
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 ***
 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      03-03-2009
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)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparison of 2 files and generating the output based on comparison Deepu Perl Misc 1 02-07-2011 03:09 PM
Price Comparison Service. Best Deal. Special Coupon atBest-Price-Comparison.com rapee Digital Photography 0 03-14-2008 06:46 AM
knowing exact string array length ? alberto C Programming 26 06-19-2006 02:43 AM
atof approximates the String, I need exact value of the string passed oksuresh@gmail.com C++ 21 04-13-2006 11:08 AM
RegExp: How to match on exact string only? Mark Findlay Javascript 6 05-16-2004 12:38 AM



Advertisments