Mid
- Last UpdatedOct 04, 2024
- 1 minute read
- PI System
- PI Server 2023
- PI Server
Return a sub-string within a string.
Syntax
Mid(s1, start [,len])
Arguments
-
s1
string
-
start
An integer specifying the position of the first character within the string. The first character in the string is number 1
len
Optional: The maximum length of the returned string. The default is the length of the string
Returns
len characters of the string to the right of (and including) the first character whose position is specified by start
Exceptions
If the arguments are not of the required types, an error value is returned. The maximum number of characters that can be returned is 999
Example
-
Mid("String", 3)
[Returns "ring"]
-
Mid("String", 3, 2)
[Returns "ri"]