Print Page | Close Window

make string not case sensitive

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=1583
Printed Date: 29 March 2026 at 5:17am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: make string not case sensitive
Posted By: JoXser
Subject: make string not case sensitive
Date Posted: 03 April 2003 at 12:40pm

Is there a way to make this code NOT case sensitive?

this simply checks a string but it is currently case sensitive how to make it NOT?

  If InStr(logon, "username") Then

Thanks
JxR

Entire code:
<%
  If InStr(logon, "username") Then

   Else
   Response.Redirect("http://www.site.com/page.asp")
     
                End If
%>




Replies:
Posted By: eagle00789
Date Posted: 03 April 2003 at 3:00pm

make it all lowercase.

put the example below in an empty asppage and upload it to your server. then do a request for that file, like
test.asp?Text=ThIs_Is_A_tEsT

'---------------- begin test.asp

<html>
<body>
<% = LCase(Request.QueryString("Text")) %>
</body>
</html>

'---------------- end test.asp

you'r code would be like

<%
  If InStr(logon, LCase("username")) Then

   Else
   Response.Redirect(" http://www.site.com/page.asp - http://www.site.com/page.asp ")
     
                End If
%>

Greetings chris



-------------
Using forum at http://www.gravenrode.nl/forum/forum - Gravenrode and http://www.gravenrode.nl/forum/test_forum - here and http://217.121.39.22/forum/test_forum - here


Posted By: JoXser
Date Posted: 03 April 2003 at 4:01pm

Thanks, but I don't think this will work as I need to check for user names (logon) & if a user enters in all caps then the above LCase will not work how you have it.

So it is if login = user or USER then

The above has the LCase in the wrong spot. will it work if LCase is in front of logon:

  If InStr(LCase(logon), "username") Then

JxR



Posted By: MorningZ
Date Posted: 03 April 2003 at 6:22pm
http://www.devguru.com/Technologies/vbscript/quickref/instr.html - http://www.devguru.com/Technologies/vbscript/quickref/instr.html

use the optional parameters to ignore case

-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: JoXser
Date Posted: 04 April 2003 at 7:28am

Yes, this is what i need to use.

so my code is now?:

<% =InStr(1, "logon", "username", VBTextCompare) %>

Thanks.
JxR




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net