Please enable JavaScript to view this site.

Knowledge Base

Navigation: Scripting Language > Functions

substring

We've made some changes. Use 'Ctrl-F5' to clear your browser cache.
Scroll Prev Top Next More

Extracts a substring from a string.

 

Supported Product: FDTD, MODE, DEVICE, INTERCONNECT

 

Syntax

Description

s1 = substring(s,pos);

Returns a substring of s, starting at position pos to the end of s. The position pos can be 1 to length(s).

s1 = substring(s,pos,len);

Returns a substring of s, starting at position pos, with len characters. If len is -1 (or any value less than 0) it returns the substring at position pos to the end of s. The default value of len is -1.

 

Example

The following example shows the different ways to extract a substring from a string.

?substring("hello",3);

llo

 

?substring("hello",3,2);

ll  

 

See Also

Functions, length, findstring, replace, replacestring, str2num, num2str, splitstring, lower, upper, toscript

Copyright Lumerical Inc. | Privacy | Site Map