Substring function
Syntax
Substring(source_str, start_pos, length)
Description
Use the Substring function to extract a substring of a specified number of characters beginning at a specified location in a source string. If the string contains Unicode non-BMP characters, each code unit of the surrogate pair is counted as a separate character, care should be taken not to split a surrogate pair using Substring.
If you know the exact length of source_str, and that it is null terminated, you can set length to 1 plus the exact length of source_str to get everything from start_pos to the end.
Parameters
| Parameter | Description |
|---|---|
|
source_str |
A String from which to extract a substring. |
|
start_pos |
A number representing the character position in source_str where the substring starts, starting at 1. |
|
length |
A number specifying the number of characters in the substring. |
Returns
Returns a String equal to a substring length characters long beginning at character start of source_str.
Example
This example sets &PAGE_NAME to the first eight characters of the name of the current page:
&PAGE_NAME = Substring(%page,1,8);