Blockland Forums > Modification Help

Strip Trailing Zeros

Pages: << < (4/4)

Ichverbot:

Yeah... Type-checking objects against Strings and Ints in TS is impossible.

"scriptObjectName" is a string.
scriptObjectName is also an object.

20152 is an intenger.
20152 is also an object.


scriptObjectName.doSomething() calls successfully.
"scriptObjectName".doSomething() is syntax error.

$object = "scriptObjectName";
$object.doSomething() calls successfully.

Space Guy:


--- Quote from: Ichverbot on November 13, 2011, 02:23:29 AM ---scriptObjectName.doSomething() calls successfully.
"scriptObjectName".doSomething() is syntax error.
--- End quote ---

==> new ScriptObject("named");
==> echo("named".getID());
5896

Ipquarx:

Does anyone know why mine won't work?

--- Code: ---function isValidInteger(%i)
{
return stripChars(%i, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()_+=[];',/{}:<>?" SPC getSubStr(%i, 0, 1) == "-" ? "" : "-") == %i && !strstr(%i, ".") < 1;
}
--- End code ---


Destiny/Zack0Wack0:

What exactly is "!strstr(%i, ".") < 1" trying to achieve? As far as I can see, it's going to be true for everything except when the decimal is at the start.

Ipquarx:

exactly, the reason i have that in is so that you cant put in the decimal first.
because .1 isn't a number (technically).
but 0.1 is.
But even if I remove that it doesn't work with decimals.

Pages: << < (4/4)

Go to full version