Returns a substring.
sSubString = SubStr (sString, iPos [, iLen])
Variable | Description |
---|---|
sSubString | The returned substring. STRING. |
sString | The string to return characters from. STRING. |
iPos | The position from which to start returning characters. INTEGER. |
iLen | Optional. The number of characters to return. INTEGER. |
SubStr returns iLen characters from sString, starting at iPos. If iLen is not specified, all characters after iPos are returned. If iLen is greater than the number of characters remaining, all characters after iPos are returned and the request for additional characters is ignored.
If iPos is beyond the end of the string or iLen is zero, SubStr returns an empty string (""). An exception is raised if iPos is less than one, or if iLen is negative.
STRING sText // text to work on STRING sItem // substring to return sText = "How much wood would a woodchuck chuck?" sItem = SubStr (sText, 23, 9) Print ("The critter of the week is the {sItem}.")