Substr()

<< Click to Display Table of Contents >>

Navigation:  Available Functions >

Substr()

Syntax

Substr( <CharacterValue>, <Numeric1>, <Numeric2> )

 

Purpose

To return a portion of a field or character value.

 

Parameters

<CharacterValue> is the name of a field, or any character expression.

 

<Numeric1> is the starting position in <CharacterValue> to begin picking off characters at.

 

<Numeric2> is the number of characters to return.

 

Returns

A Character value.

 

Usage

Use "Substr()" when you only want to compare portions of character fields to specific character values of your own making.

 

Example

You want to know all of the donors who have "5432" as the last four digits of their zip code. You know that the zip code field contains ten characters (9 digits and a dash), so the last four digits must start at the seventh character position. So, what you really want to compare against "5432" is the next four characters starting from the seventh. To do this you would create Custom selection consisting of the following single condition:

 

Substr( .Zip., 7, 4 ) = "5432"