Skip to content

substr()

Functionality

Retrieves a substring from current string. The substring starts at a specified character position and has a specified length

Syntax

How does it work?

The substr(start_ind, (optional)length) function will return the substring of the current string by zero-based starting character position 'start_ind' characters from the start and returns subsequent characters, if the length is present then it will returns only subsequent characters of specified length.

if the start_ind is greater than the length of the current string, then it will return an empty string. if the length is exceeding the length of the string then it will return only till the length of the subsequent string.

if the value does not exist or null, it will return default null.

Example

coffeeshop(base class) language properties

TypeNameValue
strnamesample coffeeshop
strdescriptionbest place to get your mood fresh & connect

source

1
2
3
4
<div>
    <span></span>
    <span></span>
</div>

output

1
2
3
4
<div>
    <span>get your mood fresh and connect</span>
    <span>get your</span>
</div>