Retrieves one or more characters from the specified position in a string.
|StringMid, OutputVar, InputVar, StartChar, Count [, L]|
|OutputVar||The name of the variable in which to store the substring extracted from InputVar.|
|InputVar||The name of the variable from whose contents the substring will be extracted. Do not enclose the name in percent signs unless you want the contents of the variable to be used as the name.|
|StartChar||The position of the first character to be extracted, which can be an expression. Unlike StringGetPos, 1 is the first character. If StartChar is less than 1, it will be assumed to be 1. If StartChar is beyond the end of the string, OutputVar is made empty (blank).|
|Count||The number of characters to extract, which can be an expression. If Count is less than or equal to zero, OutputVar will be made empty (blank). If Count exceeds the length of InputVar measured from StartChar, OutputVar will be set equal to the entirety of InputVar starting at StartChar.|
The letter L can be used to extract characters that lie to the left of StartChar rather than to the right. In this example, OutputVar will be set to Red:
If the L option is present and StartChar is less than 1, OutputVar will be made blank. If StartChar is beyond the length of InputVar, only those characters within reach of Count will be extracted. For example, the below will set OutputVar to Fox:
For this and all other commands, OutputVar is allowed to be the same variable as InputVar.
IfInString, StringGetPos, StringLeft, StringRight, StringTrimLeft, StringTrimRight, StringLen, StringLower, StringUpper, StringReplace
Source = Hello this is a test.
StringMid, the_word_this, Source, 7, 4