Handlebar Helper Function: Replace
Replaces occurrences of a search string with a replacement string in a case-sensitive manner. This ensures precise string matching and replacement.
| Parameter | Type | Description |
|---|---|---|
subject | string | Required. The string to search and replace in. Non-string inputs are converted to strings through language-level type coercion. |
search | string | Required. The string to search for (case-sensitive). Non-string inputs are converted to strings through language-level type coercion. |
replacement | string | Required. The string to replace matches with. Non-string inputs are converted to strings through language-level type coercion. |
culture | string | BCP 47 locale code for culture-specific case comparison. Supports both hyphen (en-US) and underscore (en_US) formats. Defaults to current system culture if not specified. |
The function returns the input string with all occurrences of the search string replaced by the replacement string. The search is performed case-sensitively for precise matching. If the search string is empty, no replacement occurs. If the input is null, it returns an empty string.