Go to main content

strsub

return a substring from the original string.

STRSUB

NAME

strsub - return a substring from the original string.

SYNOPSIS

strsub([start:integer, finish:integer, endblank:boolean], "string");

If endblank is true, then it will continue until a blank character (see isblank).

wstrsub work on wide character while strsub work on single byte character.

DESCRIPTION

strsub extract from string starting at position start and finish at position finish.

EXAMPLES

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

res={_{strsub(start:2,"pierre")}}. return res=erre.
res={_{strsub(start:2,"pierre","laplante")}}. return res=erreplante.
res={_{wstrsub(start:2,"péerre")}}. return res=erre.
res={_{wstrsub(finish:4,"péerre")}}. return res=péerr.
res={_{wstrsub(start:2,finish:4,"péerre")}}. return res=err.
res={_{wstrsub(start:2,finish:4,endblank:true,"péereeêrsa      abc")}}. return res=ereeêrsa.
res={_{strsub(start:2,finish:4,endblank:true,"peereeersa      abc")}}. return res=ereeersa.

SEE ALSO

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

AUTHOR

Written by Pierre Laplante, <laplante@sednove.com>

MODIFICATIONS

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

Edit

© 2024 extenso Inc. All rights reserved.