Forum Moderators: open

Message Too Old, No Replies

classic asp case select not case sensitive

aps case select

         

malinkam

9:58 pm on Feb 12, 2012 (gmt 0)

10+ Year Member



On one of our forms we use following:

myfilter = Request.Form("x_name")
myfilter = left(myfilter,5)
select case myfilter
CASE "pharm"
Response.Redirect "TESTERROR.asp"
end select

this works just fine, if word "pharm" is found it redirects user to TESTERROR.asp

But this is case sensitive and for example word "Pharm" will not get caught and it will pass through the form. How would we re-write this to work and not be case sensitive.

dstiles

11:08 pm on Feb 12, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Always has been case-sensitive - almost all tests are with the exception of the extended text comparison.

Use LCase(string) to lower case it (UCase for upper case).

It's a real pain, I agree - adds a lot more extra code on longer scripts and makes for strange debug errors. It would have been useful if there had been (eg) an AlwaysMakeCaseLower switch.