CTextRange2.MoveWhilemethod
Starts at a specified end of a range and searches while the characters belong to the set specified by *Cset* and while the number of characters is less than or equal to *Coun*t.
Syntax
FUNCTION MoveWhile (BYVAL Cset AS VARIANT PTR, BYVAL Count AS LONG = tomForward) AS LONG
Parameters
| Name | Description | |
|---|---|---|
Cset | The character set to use in the match. This could be an explicit string of characters or a character-set index. For more information, see Character Match Sets. | |
Count | Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If Count is less than zero, the search starts at the start position and goes backward — toward the beginning of the story. If Count is greater than zero, the search starts at the end position and goes forward — toward the end of the story. |
Return value
The actual count of characters end is moved.
Description
Starts at a specified end of a range and searches while the characters belong to the set specified by Cset and while the number of characters is less than or equal to Count. The range is collapsed to an insertion point when a non-matching character is found.
Starts at a specified end of a range and searches while the characters belong to the set specified by Cset and while the number of characters is less than or equal to Count. The range is collapsed to an insertion point when a non-matching character is found.
Remarks
The motion described by MoveUntil is logical rather than geometric. That is, motion is toward the end or toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
For more information, see the discussion in ITextRange and the Remarks section of Move.
The MoveWhile method is similar to MoveUntil, but MoveWhile searches as long as it finds members of the set specified by Cset, and there is no additional increment to the returned value.
The MoveStartWhile and MoveEndWhile methods move the start and end, respectively, just past all contiguous characters that are found in set of characters specified by the Cset parameter.
The following code illustrates how to initialize and use the VARIANT argument for matching a span of digits in the range pRange.
Alternatively, an explicit string could be used, as in the following sample.
Examples
DIM varg AS VARIANT varg.vt = VT_I4 varg.lVal = C1_DIGIT DIM Delta AS LONG = pRange.MoveWhile(@varg, tomForward) ' // Move IP past span of digits
DIM varg AS VARIANT varg.vt = VT_BSTR varg.bstr = SysAllocString("0123456789") DIM Delta AS LONG = pRange.MoveWhile(@varg, tomForward) ' // Move IP past span of digits
Reference
- Defined in AfxNova/CTextRange2.inc:519
- Documented in Windows/WIndows Controls/RichEdit/CTextRange2 Class.md
- Topic: CTextRange2 Class