Compare 2 strings if string 2 has the same word in it do something

Hello All;

I need to compare 2 string together and see if

str1 = "carrzkiss"
str2 = "iscarrzkissme"
if (str1 = str2) then
response.write"you cannot have your username in this string"
else
continue on
end if

Something like that.
This is for a password field, to keep people from reusing their username as part of their password.
LVL 31
Wayne BarronAuthor, Web DeveloperAsked:
Who is Participating?
 
cyberkiwiConnect With a Mentor Commented:
yup, instr is fine. use lcase as well

if instr(lcase(str2), lcase(str1)) > 0 then
  ' there is a case insensitive match
0
 
Ryan ChongCommented:
0
 
Wayne BarronAuthor, Web DeveloperAuthor Commented:
Thanks Cyber.
It was the lcase that I was missing.
0
 
Wayne BarronAuthor, Web DeveloperAuthor Commented:
I had not used this in a while, and had forgotten about how to use it.
So thankful that I had this to look back on.
Thanks once again cyberkiwi

Carrzkiss
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.