$substring

$substring

Welcome to our Knowledge Base

Documentation | Blog | Demos | Support

< All Topics
Print

$substring

Extracts a segment of a character string.

Syntax

$substring(source,position,length)

Parameters

sourcea character string, or an expression that evaluates to a character string
positiona number, or an expression that evaluates to a number
lengtha number, or an expression that evaluates to a number

Return Value

Character string, containing a string extracted from source, whose first character is position characters into source, and whose length is length characters.

Comments

Use $substring to extract a portion of source. The resulting string contains length characters, starting position characters into source.

If source is not a character data type, it is converted to a character data type before the function is applied.

If position is beyond the end of source or if length is zero or negative, the result is the null string.

If position+length is longer than source, the result consists of all characters from position to the end of source.

Example

$substring("the quick brown fox jumped",7,5)

Extracts “ick b” from the string.

$substring(9999,1,1)

Evaluates to ” ” (the number is converted to a string).

$substring(5+4,17,1)

Evaluates to “9” (the number is converted to a string).

See Also

$concat

$delete

$fill

$insert

$left

$position

$right

$squeeze

$translate

About Character Literals

About Functional Expressions

Was this article helpful?
0 out of 5 stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.

Leave a Reply

Your email address will not be published. Required fields are marked *

en_CAEnglish