4D Write v14

WR GET WORDS

Home

 
4D Write v14
WR GET WORDS

WR GET WORDS 


 

WR GET WORDS ( area ; beginSel ; endSel ; smartCutPaste ) 
Parameter Type   Description
area  Longint in 4D Write area
beginSel  Longint in Beginning of the word to return
endSel  Longint in End of the word to return
smartCutPaste  Integer in 1 if the last character is a space, otherwise 0

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

 
PROPERTIES 

Product: 4D Write
Theme: WR Text Manipulation
Number: 89465

 
HISTORY 

Created: 4D Write 6.5

 
ARTICLE USAGE

4D Write Language ( 4D Write v11.6)
4D Write Language ( 4D Write v12)
4D Write Language ( 4D Write v14)
4D Write Language ( 4D v13)
4D Write Language ( 4D Write v14 R2)
4D Write Language ( 4D Write v14 R3)
4D Write Language ( 4D Write v14 R4)