mIRC Home    About    Download    Register    News    Help

Print Thread
#96582 03/09/04 12:41 PM
Joined: Jan 2003
Posts: 1,063
D
Doqnach Offline OP
Hoopy frood
OP Offline
Hoopy frood
D
Joined: Jan 2003
Posts: 1,063
an addition for isnum to incorporate decimal and hex...

currently I check for hex using:

Code:
alias ishex {
  if (!$len($remove($1,1,2,3,4,5,6,7,8,9,0,a,b,c,d,e,f))) return $true
  else return $false
}


which is a very simple and fast (non-regexp) solution...
but since hex is a highly used system it might be nice to have a build in way like isnum

(note: this isn't some high priority thing... just a nice idea which is easely scripted)


If it ain't broken, don't fix it!
#96583 03/09/04 02:49 PM
Joined: Dec 2002
Posts: 788
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
Personally, I doubt I would use 'ishex', nor would many others, however thats not to say it couldnt be a valuable addition.

Eamonn.


#96584 03/09/04 09:38 PM
Joined: Aug 2004
Posts: 147
N
Vogon poet
Offline
Vogon poet
N
Joined: Aug 2004
Posts: 147
isbinary for auto binary translaters.

#96585 03/09/04 10:07 PM
Joined: Dec 2002
Posts: 208
H
Fjord artisan
Offline
Fjord artisan
H
Joined: Dec 2002
Posts: 208
This is actually something that i've occasionally needed. It is really easy to script with regex or whatnot, but a built-in version might be nice.


If I knew now what I will know then... maybe things will have been different...
#96586 04/09/04 12:43 PM
Joined: Dec 2002
Posts: 266
Z
Fjord artisan
Offline
Fjord artisan
Z
Joined: Dec 2002
Posts: 266
alias ishex if ($1 == $base($1,16,16)) return $true


You won't like it when I get angry.
#96587 04/09/04 01:02 PM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
This would fail with numbers like 00012EF. You could use $base($1,16,16,$len($1)) to fix it.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com

Link Copied to Clipboard