mIRC Home    About    Download    Register    News    Help

Print Thread
#70329 05/02/04 02:57 AM
Joined: Mar 2003
Posts: 16
T
t0m Offline OP
Pikka bird
OP Offline
Pikka bird
T
Joined: Mar 2003
Posts: 16
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?

#70330 05/02/04 04:41 PM
Joined: Feb 2003
Posts: 810
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
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.

Last edited by cold; 05/02/04 04:43 PM.

* cold edits his posts 24/7
#70331 06/02/04 02:14 AM
Joined: Dec 2002
Posts: 1,541
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,541
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


Those who fail history are doomed to repeat it
#70332 06/02/04 04:47 AM
Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
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


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
#70333 06/02/04 02:25 PM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
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).


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#70334 07/02/04 09:27 PM
Joined: Feb 2003
Posts: 810
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
Yes, B is one of the main reasons I'm annoyed by // and \\.


* cold edits his posts 24/7

Link Copied to Clipboard