MID

Syntax:

MID ( string , start-pos , number-chars )

Description: Extracts number-chars characters from string, starting at character position start-pos. (MID is intended for use with languages that use the single-byte character set (SBCS), whereas MIDB3.17.7.209) is intended for use with languages that use the double-byte character set (DBCS).)

Arguments:

Name

Type

Description

string

text

Designate the string from which a substring is to be extracted.

number-chars

number

The number of characters to be extracted. number-chars shall be at least 0.

start-pos

number

The starting position within string, where the first character is position 1. If start-pos is greater than the length of string, or if start-pos and number-chars combined exceeds the length of string, the whole of string shall be extracted.

Return Type and Value: text – A string containing number-chars characters from string, starting at character position start-pos.

However, if

  • start-pos < 0, #VALUE! is returned.

  • number-chars < 0, #VALUE! is returned.

example: