Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Amfitrion
Wanderer


Joined: 29 Sep 2001
Posts: 75
Location: Israel

PostPosted: Thu Jan 24, 2002 10:40 pm   

Count words
 
Suppose I have a string I captured from the mud.
How do I count the ammount of words in this string?

- Amfitrion.
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Thu Jan 24, 2002 10:44 pm   
 
%numwords(string)

Kjata
Reply with quote
Amfitrion
Wanderer


Joined: 29 Sep 2001
Posts: 75
Location: Israel

PostPosted: Fri Jan 25, 2002 12:31 am   
 
On this occasion I must say it is bugged.

It counts spaces, not words.

But thanks, it still will do it!

- Amfitrion.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Jan 25, 2002 2:27 am   
 
quote:

On this occasion I must say it is bugged.

It counts spaces, not words.

But thanks, it still will do it!

- Amfitrion.



By default, %numwords() uses a single space to denote word boundaries. You can specify any character or string you desire to mark the boundaries.

%numwords("This-is-a-test","-") should give you a count of 4

%numwords("This--is--a--test","-") should give you a count of 7, if I added correctly


li'l shmoe of Dragon's Gate MUD
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net