mIRC Home    About    Download    Register    News    Help

Print Thread
Numbers #64049 14/12/03 12:46 PM
Joined: Sep 2003
Posts: 84
T
Turbo_boy Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Sep 2003
Posts: 84
How do i get the total of the numbers in a text?

Who can help me?

thnx

Re: Numbers #64050 14/12/03 01:06 PM
Joined: Dec 2003
Posts: 33
M
Man Offline
Ameglian cow
Offline
Ameglian cow
M
Joined: Dec 2003
Posts: 33
An example of what your tring to find would be nice.

$len(text) will give you the length (number of charectors)

Re: Numbers #64051 14/12/03 01:07 PM
Joined: Sep 2003
Posts: 84
T
Turbo_boy Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Sep 2003
Posts: 84
but i only need for the number not for the char i know it like $len but i don't that hi take alle.

Re: Numbers #64052 14/12/03 02:54 PM
Joined: Apr 2003
Posts: 414
Adrenalin Offline
Fjord artisan
Offline
Fjord artisan
Joined: Apr 2003
Posts: 414

Code:
Alias TotalNumbers {
  var %Spaces = $gettok( $1-, 0 , 32)
  var %Nrs = 0
  var %i = 1
  while (%i <= %Spaces) {
    var %Curent = $gettok( $1-, %i , 32)
    if (%Curent isnum) inc %Nrs
    inc %i
  }
  return %Nrs
}

Ex. //echo -s $TotalNumbers(a b c 23 d 49 38) - return 3


mIRC Chm Help 6.16.0.3 Full Anchored!
Re: Numbers #64053 14/12/03 05:11 PM
Joined: Jan 2003
Posts: 2,523
Q
qwerty Offline
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Code:
$regex(<text>,/\d/g)


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Re: Numbers #64054 17/12/03 01:23 AM
Joined: Dec 2003
Posts: 1
S
snellbrasil Offline
Mostly harmless
Offline
Mostly harmless
S
Joined: Dec 2003
Posts: 1
try this...

alias numbers return $calc($len($1-) - $len($remove( $1-,1,2,3,4,5,6,7,8,9,0)))

ex: //echo - $numbers(a1 sd1 df33 fd ) - returns - 4