613-518-1166 info@zimdatabases.com

ZIM Language Reference

$position

< All Topics

Locates the first occurrence of a pattern in a character string.

Syntax

$position(source,pattern)

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

Return Value

Number, being the position of the first character in source that matches the first character of pattern, when pattern is found in source.

Comments

$position returns a number that identifies the start position of pattern in source. If pattern is not found in source, $position returns 0.

If either source or pattern is not of a character data type, it is converted to a character string before the operation begins. If source is of data type ALPHA or VARALPHA, the operation is case-insensitive; otherwise, the operation is case-sensitive.

Example

$position(var1,”ab”)

Evaluates to 4 if var1 is “defabc”.

$position(“abcdef”,”zz”)

Evaluates to 0.

find all Customers where $position(Comments, “overdrawn”) > 0

Determines if the word overdrawn appears in the Comments field for any one of your Customers.

See Also

$concat

$delete

$insert

$left

$replace

$right

$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