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)