SearchAndReplace Function
- Aktualisiert2025-07-21
- 1 Minute(n) Lesezeit
SearchAndReplace Function
Syntax
String SearchAndReplace(String string, String searchString, String replacementString, Number startIndex = 0, Boolean ignoreCase = False, Number maxReplacements = -1, Boolean searchInReverse = False, [Out] [Number numReplacements])
Return Value
The modified string.
Purpose
This function searches for and replaces one or more substrings with the replacementString. If you pass a property for the string parameter, the function updates the contents of the property.
Parameters
string as String
A string in which to perform substring replacements.
searchString as String
The substring to find and then replace with the replacement string.
replacementString as String
The replacement string.
startIndex as Number
An optional number that specifies the zero-based character index at which to begin searching. The default is 0.
ignoreCase as Boolean
An optional Boolean that specifies whether to ignore character case when searching. The default is False.
maxReplacements as Number
An optional number that specifies the maximum number of occurrences of substring to replace. A value of -1 signals the function to replace all occurrences of the substring. The default is -1.
searchInReverse as Boolean
An optional Boolean that specifies whether to search the string in reverse. The default is False. If you pass True, the start index passed to parameter 3 specifies the zero-based index from the end of the string of the character at which to begin searching in reverse.
numReplacements as Number
An optional number in which the function stores the number of substrings that it replaced.