mIRC Homepage
Posted By: t0m isint operator - 05/02/04 02:57 AM
hi!

how bout a ISINT operator thatd work just like isnum but with integers of real numbers?
as far as im concerned, itd be a very useful addition since i do quite a lot of error checking in my scripts.
for now when i need to check if a parameter is an integer, i match it against a regex like ?\d+$
it does the trick but this is the suggestions forum, and using this new method would let you check in a single comparison if the said parameter is not only an integer but also if its in a specified range (optional, just like isnum).

what does everyone think?
Posted By: cold Re: isint operator - 05/02/04 04:41 PM
I like this idea, mostly for the range support. Currently, I use "if (. !isin number)"; just like you said, using a range would require another isnum condition; a simple "if (number isint range)" would be nicer.
LOL, basically I've repeated what you just said.
Posted By: landonsandor Re: isint operator - 06/02/04 02:14 AM
I like the idea, but I must say, I thought you were asking for something that WASNT an operator (aka is not an operator) lol smile laugh
Posted By: Raccoon Re: isint operator - 06/02/04 04:47 AM
if ( 1 // %n ) echo -a %n is a whole number; an integer.

From the help file:

If-then-else statements
The Operators
      //     v2 is a multiple of v1
      \\     v2 is not a multiple of v1

Enjoy. grin
Posted By: qwerty Re: isint operator - 06/02/04 02:25 PM
Not that I find "isint" particularly useful, but there are some minor issues with 1 // N
a) it doens't support a range, like "isint" would
b) the number to be checked is v2, which means no $ifmatch (I never liked that in // and \\)
c) if (1 // 5.00) -> true. This one may or may not be a problem for some people, but it's certainly different from if (. !isin N).
Posted By: cold Re: isint operator - 07/02/04 09:27 PM
Yes, B is one of the main reasons I'm annoyed by // and \\.
© mIRC Discussion Forums