Compare numeric strings with leading zeros

Thierry Douez th.douez at gmail.com
Thu Sep 3 03:28:38 EDT 2015


You can use build-in functions which manipulate strings.

Please, try this one:

on mouseUp
   local userTyping = 5
   local myVeryStrongPassword = "005"
   if matchText( userTyping, myVeryStrongPassword) then
      answer "Great!"
   else
      answer "Too bad :( try again.."
      put "005" into userTyping
      if matchText( userTyping, myVeryStrongPassword) then answer "Great!"
   end if
end mouseUp

Regards,

Thierry


2015-09-03 7:00 GMT+02:00 Mark Wieder <mwieder at ahsoftware.net>:
> On 09/02/2015 09:49 PM, Ralph DiMola wrote:
>>
>> I would have thought 5=005 would evaluate as true and "5"="005" would
>> evaluate as false.
>
>
> In any other language that would work.
> Unfortunately in LC everything's stringish.
>

------------------------------------------------
Thierry Douez - http://sunny-tdz.com
sunnYrex - sunnYtext2speech - sunnYperl - sunnYmidi - sunnYmage




More information about the use-livecode mailing list