Skip to main content
Skip table of contents

substring() Operation

Syntax

set aSubstring = aString.substring(startIndex, length)
set aSubstring = substring(LITERAL, startIndex, length)

Semantics

Extracts a substring of a given length beginning at position startIndex. Returns a new string. The state of the current string is not changed. If length is greater than the length of aString, an error is raised.

Substitutables

aString

Can be any variable or object attribute having the type String.  

startIndex, length

Can be any variable or object attribute having the type Integer. The start index cannot be negative.

LITERAL

String literal.

Examples

NONE
set aSubstring = s1.substring(0, 2);

// To get the last 5 characters of a string
set endOfString = astring.substring(aString.length(-5), 5);

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.