move scanning position
Description
i3 many(c, s, i1, i2)
many() succeeds and produces the position in s after the longest initial sequence of characters in c with s[i1:i2]. It fails if s[i1] is not in c.
Parameters
- c
- character set of allowable characters.
- s
- subject string.
- i1
- start position in s.
- i2
- end position in s.
- returns
- tab position of last found character.
Defaults
- s
- &subject.
- i1
- &pos if s is defaulted, otherwise 1
- i2
- 0
Errors
101 |
i1 or i2 not integer |
103 |
s not string |
104 |
c not cset |
See Also
- any — locate initial character
- match — match initial string
- map — map characters
Examples
Example 1 — Splitting apart a Sentence:
In this example:
line = "This is the very first sentence in a paragraph"
line ? (firstWord := tab(many(&letters)) (theRest = tab(0))
will capture the first word of the sentence in one variable and the rest of the sentence in a second. The result of the above expression is:
firstWord := "This"
theRest := " is the very first sentence in a paragraph"