613-518-1166 info@zimdatabases.com

ZIM Language Reference

$replace

< All Topics

Replaces a portion of a character string with another character string.

Syntax

$replace(source,position,length,string)

Parameters

source a character string, or an expression that evaluates to a character string
position a number, or an expression that evaluates to a number
length a number, or an expression that evaluates to a number
string a character string, or an expression that evaluates to a character string

Return Value

Character string, consisting of source, with the characters starting at position for a length of length replaced by the characters from string.

Comments

Use $replace to replace, in source, the characters starting at position for a length of length, with string.

In a string, the position of the first character is always 1. If position is beyond the end of source, or if position is zero or negative, then source is left unchanged.

If length is zero or negative, then string is embedded in source starting at position (effect is like $insert).

If there are fewer than length characters from position to the end of source, all characters from position to the end of source are replaced by string.

Example

$replace(“abcdef”,2,2,”123″)

Evaluates to “a123def”.

See Also

$concat

$delete

$fill

$insert

$left

$position

$squeeze

$substring

$translate

About Character Literals

About Functional Expressions

Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Table of Contents