wordtoindex
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
| — | wordtoindex [2006/08/29 16:08] (current) – created - external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | # $EPIC: wordtoindex.txt, | ||
| + | ======Synopsis: | ||
| + | $__wordtoindex__(< | ||
| + | |||
| + | ======Technical: | ||
| + | * If the < | ||
| + | * If < | ||
| + | * If < | ||
| + | * There is only one space that separates < | ||
| + | * The return value is the character position (as would be returned by $[[index]]() and could be used by $[[right]]() et al) of the first character in the < | ||
| + | * < | ||
| + | |||
| + | ======Practical: | ||
| + | The most practical use of this function is to permit you to find the | ||
| + | beginning position of a word in a string, especially after you have had | ||
| + | to change the length of some of the words in the list. This technique is | ||
| + | most obviously used by tab completion scripts which will take the input | ||
| + | line ($L), the cursor position ($[[curpos]]()), | ||
| + | function to figure out where the cursor is. Then they rewrite the input | ||
| + | line using tab completion, and use $wordtoindex() to figure out where the | ||
| + | cursor is supposed to go after the input line has been rewritten. | ||
| + | |||
| + | ======Returns: | ||
| + | The number of characters before the beginning of the < | ||
| + | in < | ||
| + | |||
| + | ======Examples: | ||
| + | < | ||
| + | $wordtoindex(2 foo bar blah) | ||
| + | $wordtoindex(999 foo bar blah) | ||
| + | $wordtoindex(-1 foo bar blah) returns 0 | ||
| + | </ | ||
wordtoindex.txt · Last modified: 2006/08/29 16:08 by 127.0.0.1
