| TextRangeMoveWhile Method |
Starts at the end of the range and searches while the characters
belong to the set specified by chars.
The range is collapsed to an insertion point when a non-matching character is found.
Namespace: TextObjectModelAssembly: ManagedTOM2 (in ManagedTOM2.dll) Version: 1.0.5577.41188
Syntax public int MoveWhile(
params char[] chars
)
Public Function MoveWhile (
ParamArray chars As Char()
) As Integer
public:
int MoveWhile(
... array<wchar_t>^ chars
)
Parameters
- chars
- Type: SystemChar
The character set to use in the match.
Return Value
Type:
Int32The number of characters the insertion point is moved.
Exceptions Examples
The following example demonstrates the various move methods:
void MoveExamples(TextDocument document) {
TextRange range = document.EntireRange;
range.Text = "One two three four";
range.Collapse(RangePosition.Start);
range.Move(TextUnit.Word, 1);
range.MoveEnd(TextUnit.Character, 3);
Console.WriteLine("Range text is now: {0}", range.Text);
range.MoveEndWhile(' ', 't', 'r');
Console.WriteLine("Range text is now: {0}", range.Text);
range.MoveEndUntil(' ');
Console.WriteLine("Range text is now: {0}", range.Text);
range.MoveStart(TextUnit.Word, 1);
Console.WriteLine("Range text is now: {0}", range.Text);
range.MoveStartWhile('t');
Console.WriteLine("Range text is now: {0}", range.Text);
range.MoveStartUntil('e', 'r');
Console.WriteLine("Range text is now: {0}", range.Text);
range.MoveWhile(' ', 'f');
range.Text = "ive";
range.MoveUntil('o');
range.Text = " f";
range.Expand(TextUnit.Story);
Console.WriteLine("Range text is now: {0}", range.Text);
}
See Also