MID

The MID function returns a specified number of characters from a string.

The MID function is often used to manipulate strings, for example, to show shortened string values on Mimics.

Function Name

MID

Description

Returns a specified number of characters from an input string. The starting character is defined in the argument.

Arguments

MID('STRING', START, LENGTH)

Where:

  • String is the string expression in which to search. The string has to be enclosed within single quotations. For more information, see String
  • Start is a numerical expression that defines which is the first character to be included in the result. The first character in the input string is character 0, the next character is character 1, the next character 2 and so on. If the Start number is less than 0, the function begins with the first character. If the Start number is greater than or equal to the entire length of the input string, an empty string is returned.
  • Length is a numerical expression (REAL or INTEGER) that indicates the number of characters to be returned. If the LENGTH is 0, no characters are returned. If the LENGTH is equal to or greater than the total number of characters after the start character, the remaining characters are returned.
Returns

STRING.

The returned value is a string value that consists of the specified number of characters. The characters are taken from the defined input string, beginning at the first character from the left of the string.

Example:

MID( 'Main Site.Mains Control 1', 10, -1 )

The output is 'Mains Control 1'.


Disclaimer

Geo SCADA Expert 2022