STRWORDTRAN Function
Syntax
Arguments
- character
An inputted character string.
- substring
The substring to find in the inputted String.
- replacement
Optional. Default = "" (NULL). The word that replaces the substring.
- start_pos
Default = 1. Specifies which (and subsequent) occurrences will be replaced. A value N for the optional start_pos begins the replacement at the N th occurrence of the substring. Numeric
- occurrences
Optional. Default = All. Specifies the maximum number of occurrences of substring to replace with replacement string. Numeric
- every
Numeric
Description
Replaces each occurrence of a word with another.
Discussion
Replaces every occurrence of a substring in a character string with a replacement. If the replacement is omitted, the substring is replaced with NULL characters. A value N for the optional start_pos begins the replacement at the N th occurrence of the word. A value for the optional Occurrences specifies the maximum number of occurrences of Word to be replaced. Note : You can use STRWORDTRAN() with memo fields.
Example
strwordtran("partnership is the most important part of part of a successful relationship", "part", "element") -> "partnership is the most important element of element of a successful relationship" STRTRAN("partnership is the most important part of part of a successful relationship", "part", "element") -> "elementnership is the most important element of element of a successful relationship" strwordtran("She sells sea shell on the sea shore","sea","ocean", 2, 1) -> "She sells sea shell on the ocean shore"
Limitations
The substring argument is case sensitive.
See Also