613-518-1166 info@zimdatabases.com

ZIM Language Reference

$translate

< All Topics

$translate

Replaces segments of a character string with new text.

Syntax

$translate(source,pattern,replace)

Parameters

source

a character string, or an expression that evaluates to a character string

pattern

a character string, or an expression that evaluates to a character string

replace

a character string, or an expression that evaluates to a character string

Return Value

Character string, consisting of source, with replace substituted for all occurrences of pattern.

Comments

Use $translate to substitute portions of source with replace. If source, pattern, or replace are not of a character data type, they are converted to a character data type before the function is applied.

If source is of data type ALPHA or VARALPHA, searches for pattern are case-insensitive; otherwise, searches for pattern are case-sensitive.

Example

$translate(“the slow brown fox”,”slow”,”quick”)

Evaluates to “the quick brown fox”.

% translates Smith to Smythe
list all Employees where LastName = “Smith”
  format FirstName $translate(LastName,”ith”,”ythe”)

Translates occurrences of Smith to Smythe in the field LastName.

 

See Also

$concat

$delete

$fill

$left

$position

$replace

$right

$squeeze

$substring

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