Welcome to WebmasterWorld Guest from 54.163.168.15

Forum Moderators: ocean10000

classic asp case select not case sensitive

aps case select

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

5+ 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.
11:08 pm on Feb 12, 2012 (gmt 0)

WebmasterWorld Senior Member dstiles is a WebmasterWorld Top Contributor of All Time 5+ Year Member



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.
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month