wordpos()

btmux-0.6-rc4/game/text/help/cat_mux/cat_functions/wordpos() · 696 B

From the archive btonline-btechmux-0.6-rc4.tbz2

Download the archive   « Back to the archive contents

& wordpos()
 
  Syntax: wordpos(<string>, <charpos>[, <delim>)
 
  Returns the number of the word within <string> where the character 
  position <charpos> falls. Spaces between words are treated as 
  belonging to the word that follows them. If <charpos> is not within 
  the string, the value #-1 is returned. Both words and characters are 
  numbered starting at 1.
 
  <delim> may be used to specify a delimiter other than a space.
 
  Example:
 
  > say wordpos(This is a test, 4)
  You say "1"
  > say wordpos(This is a test, 5)
  You say "2"
  > say wordpos(This is a test, 6)
  You say "2"
  > say wordpos(This is a test, 20)
  You say "#-1"
 
  See Also: extract()

Site Stats

Snippets: 1791
Codebases: 571