SubString

Summary

Use the SubString function to extract a substring from a larger input string.

Syntax

SubString(<string>, <start_index>[, <end_index>])

Return Type

String

Details

The SubString function uses starting and ending index values to identify which characters to extract from the input string.

The first character in the input string is at index value 0 and is required.

The character found at the end index value is excluded from the output substring. If the end index value is omitted, the function returns the all characters found after the start index.

Examples

select SubString('abcdefghi', 2) 
from Empty();

SubString1

select SubString('abcdefghi', 2, 4) 
from Empty();

SubString2

select SubString('abcde-fghi', 2, IndexOf('abcde-fghi', '-')) 
from Empty();

SubString3

select first_name, SubString(first_name, 0, 3) 
from xactly.xc_participant;

SubString4

Related Functions

IndexOf

Length

Locate

StrLength