GetSubString

Strings
Aptilis 2

GetSubString(String, FromWhere[, HowManyCharacters])

GetSubString extracts a sub-part of a string (substring). If no length is given, then the substring goes from FromWhere to the end of the mother string.
If FromWhere is negative, it is set to 1, and HowManyCharacters is decreased by the absolute value of the original HowManyCharacters.
if HowManyCharacters is negative, characters are taken from FromWhere, then to the left.

Return Value:
A substring of the specified string.

Example 1:

a = GetSubString("short bread", 7) $
print(a$)
Result:
bread

Example 2:

t = "One two three" $
a = GetSubString(t$, 5, 3) $
print(a$)
Result:
two

Notes:
For left, right and GetSubString, indexes start at one.
if the start position goes beyond the length of the expression given, an empty string is returned.
If the length given goes beyond the expression given, only the available characters are returned, and no padding occurs.