CharRight, CharRight()

Syntax

CharRight [Count] [Select]

CharRight([Count] [Select])

Remarks

The CharRight statement moves the insertion point or the active end of the selection (the end that moves when you press SHIFT+RIGHT ARROW) to the right by the specified number of characters.

Argument

Explanation

Count

The number of characters to move. If less than one or omitted, 1 is assumed.

Select

Specifies whether to select text:

0 (zero) or omitted Text is not selected. If there is already a selection, CharRight moves the insertion point Count–1 characters to the right of the selection.

Nonzero Text is selected. If there is already a selection, CharRight moves the active end of the selection toward the end of the document.

In a typical selection made from left to right, where the active end of the selection is closer to the end of the document, CharRight extends the selection. In a selection made from right to left, it shrinks the selection.


If there is a selection, CharRight 1 changes the selection to an insertion point positioned at the right end of the original selection.

The CharRight() function behaves the same as the statement and also returns the following values.

Value

Explanation

0 (zero)

If the insertion point or the active end of the selection cannot be moved to the right.

–1

If the insertion point or the active end of the selection is moved to the right by any number of characters, even if less than Count. For example, CharRight(10) returns –1 even if the insertion point is only three characters from the end of the document.


Examples

This example moves the insertion point to the start of the current sentence and then selects the first five characters to the right:


SentLeft
CharRight 5, 1

The following example first extends the selection five characters to the right, copies the selection, and then moves the insertion point five characters to the right of the selection. Note that CharRight 6 is used to move the selection five characters to the right of the selection. This instruction is equivalent to CharRight 1, which moves the insertion point to the right end of the selection, plus CharRight 5, which then moves it five characters.


CharRight 5, 1
EditCopy
CharRight 6

See Also

CharLeft, SentLeft, SentRight, WordLeft, WordRight