version 6.0
WR O Replace (area; old; new; where; method; mode) Longint
| Parameter | Type | Description | |
| area | Longint | 4D Write area | |
| old | Text | String to search for | |
| new | Text | String to replace it with | |
| where | Integer | 0=Partial word | |
| 1=Whole word | |||
| method | Integer | 0=Not case sensitive | |
| 1=Case sensitive | |||
| mode | Integer | 0=Replace next | |
| 1=Replace all | |||
| Function result | Longint | Number of replacements |
Note 6.5: This command was only maintained for compatibility purposes. We recommend using the WR Replace command.
Description
The command WR O Replace searches for occurrences of old in area and replaces them with new. This function also returns the number of replacements. WR O Replace begins replacing from the position of the last character in the selected text.
Where determines whether old can match only whole words. If where equals 0, WR O Replace replaces old if old is part of a word. If where equals 1, WR O Replace replaces old only if old is a whole word. A whole word is a word surrounded by separator characters such as spaces or punctuation marks.
method determines whether or not the replacement will be case sensitive. If method equals 0, WR O Replace replaces old regardless of case. If method equals 1, WR O Replace replaces old only if the cases match.
mode determines how many replacements will be made.
If mode equals 0, only the next occurrence of old is replaced. If mode equals 1, all occurrences of old are replaced with new, regardless of the position of the selected text.
See Also