SEG$ |
seg$ is used to extract a sub-string located between two positions in a character string.
seg$( string, start, end )
|
Element |
Description |
Restrictions |
|
string |
Alphanumeric expression |
None. |
|
start |
Numerical integer expression for the position extraction begins. |
start >= 0 |
|
end |
Numerical integer expression for the position where extraction stops. |
end > = 0 |
# Extraction of letters of the alphabet between the 3rd and 8th letters; # this programme displays "CDEFGH" ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"Infbox seg$(ALPHABET, 3, 8)
The function seg$(string, start, end) extracts the characters of the string from the start position up to the end position inclusive. It therefore extracts at the most start-end+1.
The result is a Char type.
If start is greater than the length of the chain, or if start is greater than end, seg$(string, start, end) returns the empty string "". If the length of string is insufficient, that is, if fin > len(string), the number of characters extracted will be fewer than fin-début+1. An error is never generated from one of these two conditions.
|
Error |
Description |
|
ERMODE (10) |
The arguments are not of the corresponding type. |
|
ERDOM (50) |
start < 0 or end < 0. |
|
|