Replace
Replaces all occurrences of a specified substring with a replacement string within a source string.
Syntax
Replace(source, oldValue, newValue)
Parameters
- source (string): The source string to process
- oldValue (string): The substring to search for and replace
- newValue (string): The replacement string to substitute
Returns
- string: The modified string with all occurrences replaced
Description
Performs case-sensitive string replacement using ordinal comparison for consistent behavior across different cultural contexts.
Examples
var result1 = Replace("Hello World", "World", "Universe")
# Returns "Hello Universe"
var result2 = Replace("test test test", "test", "demo")
# Returns "demo demo demo"
var result3 = Replace("no matches here", "xyz", "abc")
# Returns "no matches here" (unchanged)