Function reference
Replaces a portion of one string with another.

Replace ( string1, start, n, string2 )


Argument Description
string1 The string in which you want to replace characters with string2.
start A long whose value is the number of the first character you want replaced. (The first character in the string is number 1.)
n A long whose value is the number of characters you want to replace.
string2 The string that replaces characters in string1. The number of characters in string2 can be greater than, equal to, or fewer than the number of characters you are replacing.

Data type: String
Returns the string with the characters replaced.

If the start position is beyond the end of the string, Replace appends string2 to string1. If there are fewer characters after the start position than specified in n, Replace replaces all the characters to the right of character start.

If n is zero, then in effect Replace inserts string2 into string1.

Example 1
This expression changes the last two characters of the string David to e to return Dave:
Replace(‘David’, 4, 2, ‘e’)

Example 2
This expression returns MY HOUSE:
Replace(‘YOUR HOUSE’, 1, 4, ‘MY’)

Example 3
This expression returns Closed for the Winter:
Replace(‘Closed for Vacation’, 12, 8, ‘the Winter’)

Feedback

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Post Comment