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

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

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
   answer "Too bad :( try again.."
   put "005" into userTyping
   if matchText( userTyping, myVeryStrongPassword) then answer "Great!"
end if
end mouseUp


Very clever. This would be my chosen solution.

--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


RE: Compare numeric strings with leading zeros

2015-09-03 Thread Ralph DiMola
Agreed + 1.
Although the "x" or checking the length will work it seems that
matchText is a lot cleaner and easier to read in the future.

Thank All!

Thanks Thierry... matchText it is!


Ralph DiMola
IT Director
Evergreen Information Services
rdim...@evergreeninfo.net

-Original 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 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

Very clever. This would be my chosen solution.

-- 
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


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, myVeryStrongPassword) then answer "Great!"
>   end if
> end mouseUp

I would caution against using matchText for this purpose, because the second 
parameter is treated by the function as a regular expression.

For instance, matchText would return true if you were to reverse your example 
values:

   local userTyping = "005"
   local myVeryStrongPassword = 5

This is because 005 does indeed contain 5.

In addition, since passwords are typically allowed to contain any character, 
including those that have special meaning in regular expressions, something 
like this would also return true:

   local userTyping = "5"
   local myVeryStrongPassword = "^5$"

With this in mind, I would go with the method of first checking the length 
followed by the values as suggested by a couple of previous posters.

Since Ralph is looking to use this for password validation, I would throw in a 
case sensitivity check as well:

on mouseUp
   put stringsAreEqual("005", "5")
end mouseUp

function stringsAreEqual pString1, pString2
   set the caseSensitive to true
   if (len(pString1) = len(pString2)) and (pString1 = pString2) then
  return true
   end if
   return false
end stringsAreEqual


Hope this helps!

Lyn



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


RE: Compare numeric strings with leading zeros

2015-09-03 Thread Ralph DiMola
Ah,

I did not have a chance to read the docs about matchText yet. This why the
uselist is one of the best lists around.

I was trying to avoid another user function but it look like stringsAreEqual
is going in my master library.

Thanks Lyn!

Ralph DiMola
IT Director
Evergreen Information 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:

> 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

I would caution against using matchText for this purpose, because the second
parameter is treated by the function as a regular expression.

For instance, matchText would return true if you were to reverse your
example values:

   local userTyping = "005"
   local myVeryStrongPassword = 5

This is because 005 does indeed contain 5.

In addition, since passwords are typically allowed to contain any character,
including those that have special meaning in regular expressions, something
like this would also return true:

   local userTyping = "5"
   local myVeryStrongPassword = "^5$"

With this in mind, I would go with the method of first checking the length
followed by the values as suggested by a couple of previous posters.

Since Ralph is looking to use this for password validation, I would throw in
a case sensitivity check as well:

on mouseUp
   put stringsAreEqual("005", "5")
end mouseUp

function stringsAreEqual pString1, pString2
   set the caseSensitive to true
   if (len(pString1) = len(pString2)) and (pString1 = pString2) then
  return true
   end if
   return false
end stringsAreEqual


Hope this helps!

Lyn



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


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


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


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 userTyping
  if matchText( userTyping, myVeryStrongPassword) then answer "Great!"
   end if
end mouseUp

Regards,

Thierry


2015-09-03 7:00 GMT+02:00 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.
>


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

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


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


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


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 second
> parameter is treated by the function as a regular expression.


Yes,
myVeryStrongPassword is a regular expression in a pure litteral form.


>
> For instance, matchText would return true if you were to reverse your
> example values:

Yes, the order of the parameters have a meaning, but this is true
for so much functions in LC. So, I don't get it :(


> In addition,
> since passwords are typically allowed to contain any character

Was not asked by the OP.

Ok then, so new  rules here:)

>local userTyping = "5"
>local myVeryStrongPassword = "^5$"

If your password can contains any chars,
Just tell it to matchText():

my password can be any character and I don't want you to
interpret them in any ways!

For that,
enclose your myVeryStrongPassword by "\Q" & "\E" and it
will be interpreted as litteral characters.


> Since Ralph is looking to use this for password validation,
> I would throw in a case sensitivity check as well:

For this one, there is nothing special to do.
If it will be case insensitive you could add a prefix to the regex: (?i)

so the final matchText() solution is:

put  "\Q^5$\E"  into  myVeryStrongPassword
if matchText( userTyping,  myVeryStrongPassword ) then ...


Ok, now I'm waiting for what I've missed...

Have all a nice day or night.

Thierry

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


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
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


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 
using it, rather than completely advise against it.

There are many ways to skin a cat, so yes, whilst it *is* possible to utilize 
Regex to perform certain tasks if done correctly, it's also easy to make 
mistakes (hence the caution) even for those who are comfortable with Regex.

> 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

Here is an example showing the issue:



on mouseUp
   local userTyping = "00^5$6"
   local myVeryStrongPassword = "^5$"
   put stringsAreEqual(userTyping, myVeryStrongPassword) & cr into msg
   put stringsAreEqual.err(userTyping, myVeryStrongPassword) & cr after msg
end mouseUp

function stringsAreEqual pString1, pString2
   return matchText(pString1, "^\Q" & pString2 & "\E$")
end stringsAreEqual

function stringsAreEqual.err pString1, pString2
   return matchText(pString1, "\Q" & pString2 & "\E")
end stringsAreEqual.err



Hope this clarifies things.

Lyn



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


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 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 second
>> parameter is treated by the function as a regular expression.
> 
> 
> Yes,
> myVeryStrongPassword is a regular expression in a pure litteral form.
> 
> 
>> 
>> For instance, matchText would return true if you were to reverse your
>> example values:
> 
> Yes, the order of the parameters have a meaning, but this is true
> for so much functions in LC. So, I don't get it :(
> 
> 
>> In addition,
>> since passwords are typically allowed to contain any character
> 
> Was not asked by the OP.
> 
> Ok then, so new  rules here:)
> 
>>   local userTyping = "5"
>>   local myVeryStrongPassword = "^5$"
> 
> If your password can contains any chars,
> Just tell it to matchText():
> 
>my password can be any character and I don't want you to
>interpret them in any ways!
> 
> For that,
> enclose your myVeryStrongPassword by "\Q" & "\E" and it
> will be interpreted as litteral characters.
> 
> 
>> Since Ralph is looking to use this for password validation,
>> I would throw in a case sensitivity check as well:
> 
> For this one, there is nothing special to do.
> If it will be case insensitive you could add a prefix to the regex: (?i)
> 
> so the final matchText() solution is:
> 
> put  "\Q^5$\E"  into  myVeryStrongPassword
> if matchText( userTyping,  myVeryStrongPassword ) then ...
> 
> 
> Ok, now I'm waiting for what I've missed...
> 
> Have all a nice day or night.
> 
> Thierry
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

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 element is equal. 
Specifically this means:

array1 = array2 if (and only if):
  - the number of elements of array1 = the number of elements of array2 and
  - for each element e in array1, array1[e] = array2[e].

I haven’t tried it and you may run into the same problem.

Peter Bogdanoff


On Sep 2, 2015, at 7:40 PM, Terry Judd  wrote:

> 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"
>  rdim...@evergreeninfo.net> wrote:
> 
>> Feeling pretty clueless here but...
>> 
>> I need ("5" = "005") to be false. This is for password validation.
>> 
>> Ralph DiMola
>> IT Director
>> Evergreen Information Services
>> rdim...@evergreeninfo.net
>> 
>> 
>> 
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


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 each before you do the
> comparison?
>
> Terry...
>
> On 3/09/2015 12:33 pm, "use-livecode on behalf of Ralph DiMola"
>  rdim...@evergreeninfo.net> wrote:
>
> >Feeling pretty clueless here but...
> >
> >I need ("5" = "005") to be false. This is for password validation.
> >
> >Ralph DiMola
> >IT Director
> >Evergreen Information Services
> >rdim...@evergreeninfo.net
> >
> >
> >
> >___
> >use-livecode mailing list
> >use-livecode@lists.runrev.com
> >Please visit this url to subscribe, unsubscribe and manage your
> >subscription preferences:
> >http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Compare numeric strings with leading zeros

2015-09-02 Thread Ralph DiMola
Thanks all. The length test or putting an alpha char before both seems like the 
easiest.  I was hoping there was another more elegant way. This makes me 
rethink my LC habits in a big way. I was hoping that there was a way to coerce 
"005" into a string of 3 chars.

Thanks again! !


Ralph DiMola
IT Director
Evergreen Information Services
rdim...@evergreeninfo.net
Office: 518-636-3998 ex:11
Cell: 518-636-3998



 Original message From: Colin Holgate 
<colinholg...@gmail.com> Date:09/02/2015  23:49  (GMT-05:00) 
To: How to use LiveCode <use-livecode@lists.runrev.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
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

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
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


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:


  put quote & "5" & quote into tFirst
  put quote & "005" & quote into tSecond
  put tFirst = tSecond

--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


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 subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


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" = "005") to be false. This is for password validation.
>
>Ralph DiMola
>IT Director
>Evergreen Information Services
>rdim...@evergreeninfo.net
>
>
>
>___
>use-livecode mailing list
>use-livecode@lists.runrev.com
>Please visit this url to subscribe, unsubscribe and manage your
>subscription preferences:
>http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


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 needs. But it will work with similar numbers that only differ by the 
number of leading zeros.



Craig Newman



-Original Message-
From: Ralph DiMola 
To: 'How to use LiveCode' 
Sent: Wed, Sep 2, 2015 10:32 pm
Subject: Compare numeric strings with leading zeros


Feeling pretty clueless here but...

I need ("5" = "005") to be false. This is
for password validation.

Ralph DiMola
IT Director
Evergreen Information
Services
rdim...@evergreeninfo.net



___
use-livecode
mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe,
unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


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 needs. But it will work with similar numbers that only differ by the 
number of leading zeros.



Craig Newman






-Original Message-
From: Ralph DiMola 
To: 'How to use LiveCode' 
Sent: Wed, Sep 2, 2015 10:32 pm
Subject: Compare numeric strings with leading zeros


Feeling pretty clueless here but...

I need ("5" = "005") to be false. This is
for password validation.

Ralph DiMola
IT Director
Evergreen Information
Services
rdim...@evergreeninfo.net



___
use-livecode
mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe,
unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


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

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


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 string specifically: quote & "5" & quote.


After that, LC wakes up and realizes you really do want a string. I 
think it's a side-effect of using an untyped language.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


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 Director
> Evergreen Information Services
> rdim...@evergreeninfo.net
> 
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Compare numeric strings with leading zeros

2015-09-02 Thread Ralph DiMola
I would have thought 5=005 would evaluate as true and "5"="005" would evaluate 
as false. 


Ralph DiMola
IT Director
Evergreen Information Services
rdim...@evergreeninfo.net
Office: 518-636-3998 ex:11
Cell: 518-636-3998



 Original message From: "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 "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

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

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

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode