Reference > Functions reference > Text functions > Replace
 

Replace

Replaces a string of characters in specified text with replacementText.

Format 

Replace(text;start;numberOfCharacters;replacementText)

Parameters 

text - any text expression or text field

start - any numeric expression or field containing a number representing the starting position in text

numberOfCharacters - any numeric expression or field containing a number representing the number of characters to remove from text

replacementText - any text expression or field containing the text to replace in the original string

Data type returned 

text

Originated in 

FileMaker Pro 6.0 or earlier

Description 

Character replacement in text begins at the start character position and continues for numberOfCharacters characters. Compare to the Substitute function.

Example 1 

Replace ( "1234567" ; 5 ; 1 ; "X" ) returns 1234X67.

Replace ( "1234567" ; 5 ; 1 ; "XX" ) returns 1234XX67.

Replace ( "1234567" ; 5 ; 2 ; "X" ) returns 1234X7.

Replace ( "1234567" ; 5 ; 0 ; "X" ) returns 1234X567.

Example 2 

Replace ( "William" ; 3 ; 4 ; "NEW TEXT" ) returns WiNEW TEXTm.

Example 3 

Replace ( PhoneNumber ; 1 ; 3 ; "415" ) returns 415-555-9054, when the PhoneNumber field contains 408-555-9054.

Related topics 

Functions reference (category list)

Functions reference (alphabetical list)

About formulas

About functions

Defining calculation fields

Using operators in formulas