if <var A> is in <var B> capital letters vs non cap issue

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
mrcoollion
Posts: 738
Joined: Thu Sep 11, 2014 1:49 pm

if <var A> is in <var B> capital letters vs non cap issue

Post by mrcoollion » Thu Jul 30, 2015 5:36 pm

Maybe I am doing something wrong but I cannot get the 'if <va A> is in <var B>' distinguish between capital letters and non capital letters.
This also goes for the 'is among the items of' command type.
Any idea's ?

Using livecode 7.06 commercial edition.

Here is some test code

Code: Select all

on mouseUp   
   #Put "P2t2r@H0me" into tocheckstring #correct string
   Put "p2t2r@h0me" into tocheckstring # wrong string , no capitals
   put "qwertyuiopasdfghjklzxcvbnm" into ListA
   put "QWERTYUIOPASDFGHJKLZXCVBNM " into ListB
   put "1234567890" into ListC
   put "!@#$%^&*()-_=+[{]};:'\|,<.>/?" into ListD
   put "correct"into CheckFormat
   put "wrong" into CheckFormatA
   put "wrong" into CheckFormatB
   put "wrong" into CheckFormatC
   put "wrong" into CheckFormatD
   repeat for each character charactertest in tocheckstring
      if  charactertest is in ListA then put "correct" into CheckFormatA
      if  charactertest is in ListB then put "correct" into CheckFormatB
      if  charactertest is in ListC then put "correct" into CheckFormatC
      if  charactertest is in ListD then put "correct" into CheckFormatD
   end repeat
   if CheckFormatA="wrong"or CheckFormatB="wrong" or CheckFormatC="wrong" or CheckFormatD="wrong" then put "wrong"into CheckFormat
   if CheckFormat is "wrong" then answer "The string must contain normal letter with at least one capital letter, one numeral and at least one special character"
   if CheckFormat is "correct" then answer "The string is ok"
end mouseUp
Kind regards,

Paul

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: if <var A> is in <var B> capital letters vs non cap issu

Post by Klaus » Thu Jul 30, 2015 5:58 pm

Hi Paul,

add this line to your script before you check "if xxx contains yyy", that should do the trick:

Code: Select all

  set the casesensitive to TRUE
Best

Klaus

mrcoollion
Posts: 738
Joined: Thu Sep 11, 2014 1:49 pm

Re: if <var A> is in <var B> capital letters vs non cap issu

Post by mrcoollion » Mon Aug 03, 2015 3:33 pm

Thanks... this works.

Regards,

Paul

Post Reply