Blockland Forums > Modification Help
How to check if a string variable has nothing?
<< < (2/3) > >>
Headcrab Zombie:
Interesting, didn't know that.
Reinforcements:
So, is "$=" for string comparison and "==" for number comparison? What would be the one if a string isn't equal to another. Something like this perhaps?

--- Code: ---if(%theString $! "")
{
<code>
}
--- End code ---
Headcrab Zombie:
!$=
Reinforcements:

--- Quote from: Headcrab Zombie on September 14, 2010, 01:34:56 AM ---I'm not sure I understood what you just said.

If it's a string, you have to use $= ""
if you just use == 0 it will always be true because trying to convert a string to a number will always be 0

--- End quote ---

--- Quote from: Headcrab Zombie on September 14, 2010, 12:06:15 PM ---!$=

--- End quote ---
Thanks
Red_Guy:
I use:
if (%str $= "")

or

if (strlen(%str) == 0)

both work to check if a string contains nothing.
Navigation
Message Index
Next page
Previous page

Go to full version