Extracts a sequence of characters from a specified location (offset) in a string variable and stores the extraction in another string variable. |
This is useful in extract a sequence of characters for use in a customer account number validation, for example.
Set the variable/value to extract from
Enter the string variable to extract from.
Set the variable to extract into
Enter the string variable in which to store the extraction.
Set the offset at which to extract
Enter the offset from which to begin extraction (a literal value preceded by =, or an integer variable).
Offset |
Description |
Example |
Positive |
Extracts from the first character after the specified offset. (An offset value that is greater than the string length results in no extraction.) |
A value of 6 applied to string X12345ABC begins extraction at 'A'. |
0 |
Extracts from the start of the string. |
For the string X12345ABC, extraction begins at 'X'. |
Negative |
Locates the offset from the end of the string and then extracts from the first character after this location. (An offset that is greater than or equal to the string length is equivalent to using a 0 offset.) |
A value of -3 applied to string X12345ABC begins extraction at 'A'. (A value of -9 begins extraction at 'X'.) |
Set the number of characters to extract.
The number of characters to extract in a left-to-right direction from the offset location.
Number of characters |
Description |
Example |
Positive |
Extracts the specified number of characters from the offset location. (A value that is greater than the string length results all characters being extracted.) |
Assuming an offset of 1, a value of 5 applied to string X12345ABC extracts '12345'. (A value of 9 results in all characters being extracted.) |
Negative |
Excludes the specified number of characters from the end of the string and extracts the remaining characters. (A value that is greater than or equal to the number of characters from the offset location, results in no extraction.) |
Assuming an offset of 1, a value of -3 applied to string X12345ABC extracts '12345'. (A value of -8 results in no extraction.) |
Exit point |
Taken |
[Complete] |
When cell execution completes. |