Jump to content

Recommended Posts

Posted

I have a question regarding data types. According to a page I found on this site, when a variable = "" (empty string), then it will be considered a boolean type false and have a value of zero. When I perform a logic check against it (if $strVariable = "" then...) it doesn't register as true because $strVariable actually has a value of zero. I can't make the logic check: if $strVariable = 0 then...because the variable may actually legitimately contain a zero for the value. Any thoughts on how to check if the $strVariable simply = an empty string at all? Or, how to have AutoIT explicitly treat the variable as a string?

Thank you,

jbg1978

  • Moderators
Posted

If StringLen($strVariable) = 0 Then

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted

I have a question regarding data types. According to a page I found on this site, when a variable = "" (empty string), then it will be considered a boolean type false and have a value of zero. When I perform a logic check against it (if $strVariable = "" then...) it doesn't register as true because $strVariable actually has a value of zero. I can't make the logic check: if $strVariable = 0 then...because the variable may actually legitimately contain a zero for the value. Any thoughts on how to check if the $strVariable simply = an empty string at all? Or, how to have AutoIT explicitly treat the variable as a string?

Thank you,

jbg1978

There are String() and IsString()

$strVariable = String($strVariable)

That's string for sure.

♡♡♡

.

eMyvnE

  • 2 weeks later...
Posted (edited)

I've already tried some of the suggestions before I posted. Like converting to string still updated the recordset with a zero, and logic check if "" = $str still produced false for me. The length($str) did end up being the resolution though. It worked like a charm. Thank you! Thanks to everyone who posted.

Edited by jbg1978

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...