strextract

strextract returns a substring of its argument string.

ssExtract = strextract(ssString, nPosition)
ssExtract = strextract(ssString, nPosition, nLength)

Return Value

ssExtract is a substring of the scalar string ssString of the length nLength. In case of an error, the function returns an empty string (“”).

Parameters

ssString

ssString is a scalar string.

nPosition

nPosition is the start position of the substring character counting starts with 1.

nLength

nLength defines the length of the substring. If the function is called with two parameters, the function returns substring from the start position to the end of the string. If the number of characters starting at nPosition is smaller than nLength, the function returns the remaining characters.

Example

* strextract("This is a String", 6, 4)
* is a
* strextract("This is a String", 6)
* is a String

History

Version Description
5.11.1 If the number of characters starting at nPosition is smaller than nLength, the function returns the remaining characters. Before that change the function returned an empty string.
4.2.0 The function can be used for 8-bit clean strings (may contain 0-characters).

id-1792161