Forum Moderators: open

Message Too Old, No Replies

How to search a string for a character in ASP?

         

kevinj

2:26 pm on Apr 9, 2003 (gmt 0)

10+ Year Member



I have a text string called director_name that I need to search for a '&' character. If the & appears in the string, I need to set a variable called directors equal to 1. Does anyone know how I can do this?

Thanks.

Dreamquick

2:40 pm on Apr 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Would this work?

If InStr( director_name, "&" ) > 1 Then directors = 1

- Tony

WebJoe

2:43 pm on Apr 9, 2003 (gmt 0)

10+ Year Member



Does this work for you?

If Instr(1, director_name, "&") <> 0 then directors = 1

oops...I guess Dreamquick was a bit faster, but that confirms that this would be a solution...

kevinj

3:07 pm on Apr 9, 2003 (gmt 0)

10+ Year Member



Works perfect. Thanks Dreamquick and WebJoe!