Welcome to WebmasterWorld Guest from

Forum Moderators: ocean10000

Message Too Old, No Replies

classic asp case select not case sensitive

aps case select

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

Junior Member

5+ Year Member

joined:Jan 25, 2008
votes: 0

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)

Senior Member from GB 

WebmasterWorld Senior Member dstiles is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:May 14, 2008
votes: 4

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.