Loading...
 

Mid

Mid

Mid(fmtString, flags), Mid(fmtString), Mid(STACK, flags), Mid(STACK ), Mid(, flags), Mid

parameters: format string for sprintf, flags for ViewExport

Stack
Stack Position Description
Stack(In) Top any
Top 1 length (number of characters)
top 2 offset (left start position)
Stack(Out) Top (Partial) character string

As with the String statement, any data is transformed from the stack top into a character string, from which a substring is formed, to which exactly the m characters following from the nth character belong. This string appears as the result of the operation on the stack-top.

216114
If offset ≤ -1 or length ≤ -1 then the values are interpreted as follows:
(-n) = (Cardinality - n)

For the offset -n means that Mid should start from the right at the nth character.
For the length -n means that Mid shortens the returned string to the length of the original string minus n characters, analogous to Left.

0 0 "1234567890" Mid // -> "" 0 1 "1234567890" Mid // -> "1" (-1) 1 "1234567890" Mid // -> "0" (== 9 1 Mid) (-3) 2 "1234567890" Mid // -> "89" (== 7 2 Mid) 0 (-1) "1234567890" Mid // -> "123456789" (== 0 9 Mid)

Related topics