Skip to main content
Skip table of contents

substring() Operation

Syntax
NONE
set aSubstring = aString.substring(startIndex, length)
set aSubstring = substring(LITERAL, startIndex, length)
SemanticsExtracts 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

aStringCan be any variable or object attribute having the type String.  
startIndex, lengthCan be any variable or object attribute having the type Integer. The start index cannot be negative.
LITERALString literal.
Examples
NONE
set aSubstring = stringSet.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.