Command WR GET WORDS

4D Write

WR GET WORDS

version 6.5


WR GET WORDS (area; beginSel; endSel; smartCutPaste)

ParameterTypeDescription
areaLongint4D Write area
beginSelLongintBeginning of the word to return
endSelLongintEnd of the word to return
smartCutPasteInteger1 if the last character is a space,
otherwise 0

Description

The WR GET WORDS command returns the position of the first character of the first word of the selection and the position of the last character of the last word of the selection. It also specifies if the last character of the selection is a space. If no text is selected, beginSel and endSel returns the first and last character of the word the cursor is in.

This command has no effect on the current selection.

If the selection begins in the middle of a word (or between the last character of a word and the next following space), beginSel will return the position of the first character of that word.

If the selection ends in the middle of a word, there are two possible cases:

• If the word is followed by a space, endSel will include the space and smartCutPaste will return 1.

• If the word is not followed by a space, endSel will include the last character of the word and smartCutPaste will return 0.

Example

The following example scans the document and retrieves the position of the first and last characters for each word.

      `Placing the cursor at the beginning of the area
   WR SET SELECTION (area;0;0)
      `Counting the number of words in the document
   nbWords:=WR Count(area;wr nb words)
      `Processing the words one by one
   For ($i;1;nbWords)
         `Retrieving the position of the first and last character of the word
      WR GET WORDS(area;beginning;pos)
         `Relocating after the last processed word
      WR SET SELECTION (area;Pos;Pos)
   End for

See Also

WR Get selected text, WR Get text.