Jump to content

Recommended Posts

Posted

the reason is you using the == operator, which is dedicated to case-sensitive string comparison, for boolean and numeric comparison, not cool.

Signature - my forum contributions:

  Reveal hidden contents

 

Posted (edited)

"1" is a string, and 1 is a number, TRUE is boolean....

you should not compare a string with a number ! The result of a comparison is TRUE or FALSE

(1 = "1") is (should be) FALSE   //EDIT (but NOT in AutoIt because of datatype "variant"?! ) so (1="1") in AutoIt is TRUE

(1 = TRUE) is TRUE

Edited by AndyG
Posted (edited)

More precisely, when you write:

If StringIsDigit($tmp) == True Then

the interpretor understands:

If '1' == 'True' Then

because == forces the conversion of its operands to strings and StringIsDigit returns the integer 0 or 1 (1 in your case), while the string 'True' stays by itself. Since the == comparison is over verbatim (case-insensitive) strings, it clearly fails.

The lazy, simple and robust way to code that condition is:

If StringIsDigit($tmp) Then
Edited by jchd
  Reveal hidden contents

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Posted (edited)
  On 9/27/2016 at 8:32 PM, jchd said:

 

The lazy, simple and robust way to code that condition is:

If StringIsDigit($tmp) Then
Expand  
 
 
 
 

Indeed!

@Muhammad_Awais_Sharif  ...Use a single equals (=) for comarison, as well as assignment in AutoIt for cases like this...or just say "If X Then" (whenever X is true..."Then" will execute)

(...It took me a few minutes to wrap my head around the 'single equals comparison' as well, so you're in good company!) :)

bloopie

Edited by bloopie
clarification

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...