2.5.4.67 Mid

The Mid function returns part of a string, starting at the position specified, based on the number of characters specified.

ABNF:

 Mid = val val val " MID():128"

Required Arguments:

Name: Text

Type: vString

An argument that specifies the text string.

Name: StartPos

Type: vSignedLong

An argument that specifies the one-based index in Text which represents the beginning of the substring to be returned.

Name: NumChars

Type: vSignedLong

An argument that specifies the number of characters to be returned.

Return Value:

Type: PtgStr1, PtgErr

This function returns a PtgStr1 containing a substring of Text, starting from StartPos up to the character at StartPos plus NumChars minus one. If StartPos is zero, the function returns a PtgErr with an error code of #VALUE!. If StartPos is less than zero or greater than the number of characters in Text, the function returns a PtgStr1 containing an empty string. If StartPos plus NumChars minus one exceeds the length of Text, or if NumChars is less than zero, the function returns a PtgStr1 containing the substring of Text starting from StartPos up to the end of Text.