Author Topic: Strip Trailing Zeros  (Read 1866 times)

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.

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

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

Does anyone know why mine won't work?
Code: [Select]
function isValidInteger(%i)
{
return stripChars(%i, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()_+=[];',/{}:<>?" SPC getSubStr(%i, 0, 1) == "-" ? "" : "-") == %i && !strstr(%i, ".") < 1;
}

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.

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.