Re: Compare numeric strings with leading zeros

2015-09-04 Thread Thierry Douez
> What’s wrong with simply: > > function stringsAreEqual p1, p2 >return (p1 & "z") = (p2 & "z") > end stringsAreEqual > > As Terry Judd and Mark Wieder suggested yesterday? Mmm, nothing. Different ways, different experiences ... :) Regards, Thierry

Re: Compare numeric strings with leading zeros

2015-09-03 Thread J. Landman Gay
On 9/3/2015 2:28 AM, Thierry Douez wrote: 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

RE: Compare numeric strings with leading zeros

2015-09-03 Thread Ralph DiMola
al Message- From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf Of J. Landman Gay Sent: Thursday, September 03, 2015 3:20 PM To: How to use LiveCode Subject: Re: Compare numeric strings with leading zeros On 9/3/2015 2:28 AM, Thierry Douez wrote: > You can use build-in fu

Re: Compare numeric strings with leading zeros

2015-09-03 Thread Lyn Teyla
Thierry Douez wrote: > 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,

RE: Compare numeric strings with leading zeros

2015-09-03 Thread Ralph DiMola
Services rdim...@evergreeninfo.net -Original Message- From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf Of Lyn Teyla Sent: Thursday, September 03, 2015 4:35 PM To: How to use LiveCode Subject: Re: Compare numeric strings with leading zeros Thierry Douez wrote

RE: Compare numeric strings with leading zeros

2015-09-03 Thread FlexibleLearning.com
I would simply force a string comparison... return num1 & space=num2 & space Hugh Senior FLCo > From: "Ralph DiMola" > > Feeling pretty clueless here but... > > I need ("5" = "005") to be false. This is for password validation. > > Ralph DiMola

Re: Compare numeric strings with leading zeros

2015-09-03 Thread Thierry Douez
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

RE: Compare numeric strings with leading zeros

2015-09-03 Thread FlexibleLearning.com
Or even just EMPTY converts to a string... return num1 & ""=num2 & "" Hugh Senior FLCo > From: "Ralph DiMola" > > Feeling pretty clueless here but... > > I need ("5" = "005") to be false. This is for password validation. > > Ralph DiMola

Re: Compare numeric strings with leading zeros

2015-09-03 Thread Thierry Douez
Hi, > Ah, Well, nothing very dangerous here :) >> if matchText( userTyping, myVeryStrongPassword) then ... This was a direct answer to this thread: "compare numeric strings with leading zeros" ! > I would caution against using matchText for this purpose, > because the

Re: Compare numeric strings with leading zeros

2015-09-03 Thread Thierry Douez
> >> Ok, now I'm waiting for what I've missed... > > Your revised example was missing a "^" at the beginning and a "$" at the end. > >put "^\Q^5$\E$" into myVeryStrongPassword > > Lyn > Good catch :) Regards, Thierry ___ use-livecode mailing list

Re: Compare numeric strings with leading zeros

2015-09-03 Thread Lyn Teyla
Thierry Douez wrote: > put "\Q^5$\E" into myVeryStrongPassword > if matchText( userTyping, myVeryStrongPassword ) then ... Here is indeed an example of the danger involved with the use of regular expressions. It can be easy to miss things at times, which is why I simply cautioned against

Re: Compare numeric strings with leading zeros

2015-09-03 Thread Jerry Jensen
What’s wrong with simply: function stringsAreEqual p1, p2 return (p1 & "z") = (p2 & "z") end stringsAreEqual As Terry Judd and Mark Wieder suggested yesterday? .Jerry > On Sep 3, 2015, at 8:56 PM, Thierry Douez wrote: > > Hi, > >> Ah, > > Well, nothing very

Re: Compare numeric strings with leading zeros

2015-09-02 Thread Peter Bogdanoff
How about comparing as an array? >From the LC Dictionary definition for “is": When comparing arrays, the = operator first checks if the number of elements in each array is the same, if not the two arrays are different. If the arrays have the same number of elements, they are equal if each

Re: Compare numeric strings with leading zeros

2015-09-02 Thread Mike Bonner
Could to a slightly more complex check.. First check if the length is the same, then do the comparison. (could even check length, then do a char by char comparison) On Wed, Sep 2, 2015 at 8:40 PM, Terry Judd wrote: > Can you add a non-numeric character in front of

Re: Compare numeric strings with leading zeros

2015-09-02 Thread Ralph DiMola
unrev.com> Subject: Re: Compare numeric strings with leading zeros Is there ever a case where this would return true?: put "005" into a put "5" into b answer a = b and length(a) = length(b) ___ use-livecode mailing list

Re: Compare numeric strings with leading zeros

2015-09-02 Thread Mark Wieder
On 09/02/2015 07:40 PM, Terry Judd wrote: Can you add a non-numeric character in front of each before you do the comparison? +like. I usually add an 'x' prefix. -- Mark Wieder ahsoftw...@gmail.com ___ use-livecode mailing list

Re: Compare numeric strings with leading zeros

2015-09-02 Thread J. Landman Gay
Ralph DiMola wrote: Feeling pretty clueless here but... I need ("5" = "005") to be false. This is for password validation. I could swear this used to work using some tricky combination of < and >. Anyway, the trick is to make them compare as strings. Forcing quotation marks seems to work:

Re: Compare numeric strings with leading zeros

2015-09-02 Thread Colin Holgate
Is there ever a case where this would return true?: put "005" into a put "5" into b answer a = b and length(a) = length(b) ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your

Re: Compare numeric strings with leading zeros

2015-09-02 Thread Terry Judd
Can you add a non-numeric character in front of each before you do the comparison? Terry... On 3/09/2015 12:33 pm, "use-livecode on behalf of Ralph DiMola" wrote: >Feeling pretty clueless here but... > >I need ("5" =

Re: Compare numeric strings with leading zeros

2015-09-02 Thread dunbarx
Hi. Not sure what test values fit your needs, but does this help? function noZeros arg1.arg2 if the length of arg1 <> the length of arg2 and arg1 = arg2 then return "false" else return "true" end noZero This sidesteps several issues, but may not address, as I mentioned above, all your

Re: Compare numeric strings with leading zeros

2015-09-02 Thread dunbarx
Hi. Not sure what test values fit your needs, but does this help? function noZeros arg1.arg2 if the length of arg1 <> the length of arg2 and arg1 = arg2 then return "false" else return "true" end noZero This sidesteps several issues, but may not address, as I mentioned above, all your

Re: Compare numeric strings with leading zeros

2015-09-02 Thread Mark Wieder
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. -- Mark Wieder ahsoftw...@gmail.com

Re: Compare numeric strings with leading zeros

2015-09-02 Thread J. Landman Gay
On 9/2/2015 11:49 PM, Ralph DiMola wrote: I would have thought 5=005 would evaluate as true and "5"="005" would evaluate as false. LC will read "5" as a number because it will interpret what is inside the quotes rather than see the whole thing as a string. You have to add the quotes to the

Re: Compare numeric strings with leading zeros

2015-09-02 Thread Scott Rossi
wholeMatches? Regards, Scott Rossi Creative Director Tactile Media UX/UI Design > On Sep 2, 2015, at 7:33 PM, Ralph DiMola wrote: > > Feeling pretty clueless here but... > > I need ("5" = "005") to be false. This is for password validation. > > Ralph DiMola > IT

Re: Compare numeric strings with leading zeros

2015-09-02 Thread Ralph DiMola
uot;J. Landman Gay" <jac...@hyperactivesw.com> Date:09/03/2015 00:42 (GMT-05:00) To: How to use LiveCode <use-livecode@lists.runrev.com> Subject: Re: Compare numeric strings with leading zeros On 9/2/2015 11:16 PM, Ralph DiMola wrote: > I was hoping that there was a way to coerce &qu

Re: Compare numeric strings with leading zeros

2015-09-02 Thread J. Landman Gay
On 9/2/2015 11:16 PM, Ralph DiMola wrote: I was hoping that there was a way to coerce "005" into a string of 3 chars. Adding specific quotes around it does that. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com