Goto main content

substr

Return part of a string.

SUBSTR

NAME

substr - Return part of a string.

SYNOPSIS

substr(string,start,limit)

PARAMETERS

string
The input string. Must be one character or longer.
start
If start is non-negative, the returned string will start at the start’th position in string, counting from zero. For instance, in the string abcdef, the character at position 0 is a, the character at position 2 is c, and so forth. If start is negative, the returned string will start at the start’th character from the end of string.
limit
If length is given and is positive, the string returned will contain at most length characters beginning from start (depending on the length of string). If length is given and is negative, then that many characters will be omitted from the end of string (after the start position has been calculated when a start is negative). If start denotes the position of this truncation or beyond, false will be returned.

RETURN

Returns the extracted part of string or an empty string.

EXAMPLES

Note: In the followings examples, the _ between the { should be removed to make it work.

res={_{substr("pierre",1,2)}}. return res=ie.

SEE ALSO

{{ include("includes/strings.sn") }}

AUTHOR

Written by Pusnei Sergey, <sergey@sednove.com>

MODIFICATIONS

1.0 2014-09-09 21:24:14 laplante@sednove.com

Edit

© 2022 extenso Inc. All rights reserved.