4D Write v14WR Replace |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D Write v14
WR Replace
|
WR Replace ( area ; searchedFor ; replaceWith ; wholeWord ; upperCase ; replaceAll ; wrap ) -> Function result | ||||||||
Parameter | Type | Description | ||||||
area | Longint |
![]() |
4D Write area | |||||
searchedFor | String |
![]() |
Character string to search for | |||||
replaceWith | String |
![]() |
Replacement character string | |||||
wholeWord | Integer |
![]() |
0=partial match 1=whole word | |||||
upperCase | Integer |
![]() |
0=ignore uppercase 1=case sensitive | |||||
replaceAll | Integer |
![]() |
0=replace next 1=replace all | |||||
wrap | Integer |
![]() |
0=search from the selection 1=search the whole document | |||||
Function result | Longint |
![]() |
Number of occurrences replaced | |||||
The WR Replace command allows you to emulate the Replace command menu of the Edit menu.
In the wholeWord parameter, you can pass one of the following constants, found in the WR Parameters theme:
Constant | Type | Value | Comment |
wr partial match | Longint | 0 | The character string can either be a whole word or part of a longer word |
wr whole word | Longint | 1 | To be found, the word must occur between separator characters (spaces, punctuation marks, etc.) |
In the upperCase parameter, you can pass one of the following constants, found in the WR Parameters theme:
Constant | Type | Value | Comment |
wr ignore uppercase | Longint | 0 | The search is not case sensitive and will find both “Hello”, “hello” and “HELLO“... if you search for “HELLO” |
wr case sensitive | Longint | 1 | The search is case sensitive and will not find “Hello” if you are searching for “HELLO” |
In the replaceAll parameter, you can pass one of the following constants, found in the WR Parameters theme:
Constant | Type | Value | Comment |
wr replace next | Longint | 0 | Only the next occurrence of the word will be replaced |
wr replace all | Longint | 1 | All the occurrences of the word will be replaced |
In the wrap parameter, you can pass one of the following constants, found in the WR Parameters theme:
Constant | Type | Value | Comment |
wr after insertion point | Longint | 0 | The search begins at the insertion point and continues to the end of the document. |
wr whole document | Longint | 1 | The search begins at the insertion point, continues to the end and then starts again at the beginning of the document until it again reaches the insertion point. |
WR Replace returns the number of occurrences replaced.
You want to remove all unnecessary double spaces in your document:
`Assigning a variable that contains double space characters
ToFind:=" "
`While occurrences are found
While(WR Find(Area;ToFind;wr partial match;wr ignore uppercase;wr whole document)=1)
`Replacing double space by a single one
$n:=WR Replace(Area;ToFind;" ";wr partial match;wr ignore uppercase;wr replace all;wr whole document)
End while
Product: 4D Write
Theme: WR Text Manipulation
Number:
89453
Created: 4D Write 6.5
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)