mIRC Home    About    Download    Register    News    Help

Print Thread
#36783 16/07/03 11:21 PM
Joined: Dec 2002
Posts: 45
P
piko Offline OP
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Dec 2002
Posts: 45
"isalpha text contains only letters"
is !isalpha equal to "text contains only numbs"?

#36784 16/07/03 11:23 PM
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
No. !isalpha mean it doesn't contain only letters, i.e. contains numbers or other characters such as @,#,[, etc.

#36785 17/07/03 02:30 AM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
From the help file (/help if-then-else):
Code:

   [color:#840017]isin[/color]       string v1 is in string v2
   [color:#840017]isincs[/color]     string v1 is in string v2 (case sensitive)
   [color:#840017]iswm[/color]       wildcard string v1 matches string v2
   [color:#840017]isnum[/color]      number v1 is a number in the range v2 which is in the form n1-n2 (v2 optional)
   [color:#840017]isletter[/color]   letter v1 is a letter in the list of letters in v2 (v2 optional)
   [color:#840017]isalnum[/color]    text contains only letters and numbers
   [color:#840017]isalpha[/color]    text contains only letters
   [color:#840017]islower[/color]    text contains only lower case letters
   [color:#840017]isupper[/color]    text contains only upper case letters

Therefore, "contains only numbers" would not be !isalpha, but would be isnum.


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#36786 17/07/03 10:08 AM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Just a detail that might interest paki. isnum reports "true" in cases like -100, 1.234, -1.234, ie it checks whether the entire v2 argument is a number, not whether it contains only digits. To check the latter, one could use
if ($regex(<string>,/^\d+$/))
or
if (<string> isnum 0- && . !isin <string> && <string> != -0)


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

Link Copied to Clipboard