Table of Contents

Search

  1. Preface
  2. Part 1: Concepts and Models
  3. Part 2: Custom XConnect Created with a Load Template
  4. Appendix A: Resource Configuration File

Metadata Manager Custom Metadata Integration Guide

Metadata Manager Custom Metadata Integration Guide

substr Function

substr Function

Returns a portion of a string. substr counts all characters, including blanks, starting at the beginning of the string.
The function name is case sensitive.

Syntax

substr(
string
,
start
[,
length
] )
The following table describes the substr arguments:
Argument
Required/Optional
Description
string
Required
Must be a character string. You can enter an expression. Passes the strings you want to search. If you pass a numeric value, the function converts it to a character string.
start
Required
Must be an integer. The position in the string where you want to start counting. You can enter an expression. If the start position is a positive number, substr locates the start position by counting from the beginning of the string. If the start position is a negative number, substr locates the start position by counting from the end of the string. If the start position is 0, substr searches from the first character in the string.
length
Optional
Must be an integer greater than 0. The number of characters you want substr to return. You can enter an expression. If you omit the length argument, substr returns all of the characters from the start position to the end of the string. If you pass a negative integer or 0, the function returns an empty string. If you pass a decimal, the function rounds it to the nearest integer value.

Return Value

String.
Empty string if you pass a negative or 0 length value.
NULL if a value passed to the function is NULL.

Example

The following expressions return the phone number without the area code for each row in the PHONE column:
substr( PHONE, 5, 8 )
PHONE
RETURN VALUE
808-555-0269
555-0269
809-555-3915
555-3915
357-687-6708
687-6708
NULL
NULL

0 COMMENTS

We’d like to hear from you!