mIRC Homepage

Numbers

Posted By: Turbo_boy

Numbers - 14/12/03 12:46 PM

How do i get the total of the numbers in a text?

Who can help me?

thnx
Posted By: Man

Re: Numbers - 14/12/03 01:06 PM

An example of what your tring to find would be nice.

$len(text) will give you the length (number of charectors)
Posted By: Turbo_boy

Re: Numbers - 14/12/03 01:07 PM

but i only need for the number not for the char i know it like $len but i don't that hi take alle.
Posted By: Adrenalin

Re: Numbers - 14/12/03 02:54 PM


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
Posted By: qwerty

Re: Numbers - 14/12/03 05:11 PM

Code:
$regex(<text>,/\d/g)
Posted By: snellbrasil

Re: Numbers - 17/12/03 01:23 AM

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

© 2022 mIRC Discussion Forums