Product Documentation
Cadence SKILL Language Reference
Product Version IC23.1, November 2023

substring

substring( 
S_string 
x_index 
[ x_length ] 
) 
=> t_result / nil 

Description

Creates a new substring from an input string, starting at an index point and continuing for a given length.

Creates a new substring from S_string with a starting point determined by x_index and length determined by an optional third argument x_length.

Arguments

S_string

A string.

x_index

Starting point for returning a new string. Cannot be zero.

x_length

Length of string to be returned.

Value Returned

t_result

Substring of S_string starting at the character indexed by x_index, with a maximum of x_length characters.

nil

If x_index is out of bounds.

Examples

substring("abcdef" 2 4)    
=> "bcde"
substring("abcdef" 4 2)  
=> "de"
substring("abcdef" -4 2)  
=> "cd"

Related Topics

String Functions

parseString


Return to top
 ⠀
X