mIRC Home    About    Download    Register    News    Help

Print Thread
#112700 26/02/05 06:09 AM
Joined: Oct 2003
Posts: 80
R
Babel fish
OP Offline
Babel fish
R
Joined: Oct 2003
Posts: 80
What is the best way to count the words in $1-? I currently can only think of counting spaces between the words. However a user could add 2 spaces and would be inaccurate. Ideas Please


RockHound
#112701 26/02/05 06:11 AM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
$0 = the number of $N's smile

#112702 26/02/05 06:14 AM
Joined: Oct 2003
Posts: 80
R
Babel fish
OP Offline
Babel fish
R
Joined: Oct 2003
Posts: 80
Ty Lori I never knew that before


RockHound
#112703 26/02/05 06:29 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
mIRC eliminates the 2nd occurance of $chr(32) (space).
Code:
I type //echo -a $gettok(hello     how     are     you     doing     today?,0,32)

It returns 6 which is the number of words.

I type //echo -a $numtok(hello     how     are     you     doing     today?,32)

Will also return 6.


On *:Text:*:#: {
  echo -a $gettok($1-,0,32) words.
  echo -a $numtok($1-,32) words.
  echo -a $0 words.
}


Link Copied to Clipboard