--- title: "replace-chars( a, b, c[, d] )" slug: "string-replace-chars" updated: 2026-08-17T08:03:48Z published: 2026-08-17T08:03:48Z canonical: "docs.lobstersoftware.com/string-replace-chars" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.lobstersoftware.com/llms.txt > Use this file to discover all available pages before exploring further. # replace-chars( a, b, c[, d] ) This function replaces every occurrence of a character in text **a** that is also contained in string **b** with the character that occurs in string **c** at the same index position (see examples). If **b** and **c** have different lengths, the characters in the longer list are ignored. ## Parameters | Parameter | Description | | --- | --- | | a | Text. | | b | Characters to be replaced. | | c | Replacement characters. | | d | (optional) *true* or *single* stops the process after the first replacement of each character (so no recursive replacements, see examples). Default: *false*. | ## Examples | Parameter a | Parameter b | Parameter c | Parameter d | Result | | --- | --- | --- | --- | --- | | ABCDEF | AC | 12 | | 1B2DEF | | ABCDEF | AC2 | 12_ | | 1B_DEF ( **NOTE:** C was first replaced by 2 and then 2 by _) | | ABCDEF | AC2 | 12_ | true | 1B2DEF ( **NOTE:** C was only replaced by 2) | | ABCDEF | AC2 | 12_ | single | 1B2DEF ( **NOTE:** C was only replaced by 2) |