Top | Up (String) | < Previous (PAGE NAME) | Next (PAGE NAME) >
Extract characters from a string, starting on the specified pos%
of the string.
MID$ string$, pos%, length% OUT substring$
Parameter | Description |
---|---|
string$ | A string. |
pos% | Position on string$ to start extracting characters. |
length% | The number of characters to extract, starting from pos% . Can’t be less than 0. |
Output | Description |
---|---|
substring$ | The extracted characters from string$ |
If pos%
is bigger than the length of string$
, the function does not trigger an error. Instead, returns nothing.
PRINT MID$("TEST",1,2) ' ES
PRINT MID$("12345",3,1) ' 4
Error | Cause |
---|---|
Out of range | length% is less than 0, or pos% is less than 0. |
Top | Up (String) | < Previous (PAGE NAME) | Next (PAGE NAME) >