omron — $MID string function

$MID string function $MID string function Syntax $MID (string, first_char , num_chars) Function Return a substring of the specified string. Parameters string String variable, constant, or expression from which the substring is extracted. first_char Optional real-valued expression that specifies the first character of the substring. num_chars Real-valued expression that specifies the number of characters to be copied to the substring. Details If first_char is omitted or has a value less than or equal to 1, the substring starts with the first character of string . If first_char is larger than the length of the input string, the function returns an empty string.

If there are fewer than num_chars characters from the specified starting character position to the end of the input string, the output string consists of only the characters up to the end of the input string. That is, no error results and the output string is not extended to the requested length. Example The instructions below result in the string variable $substring containing the string cd, since cd is the 2-character string that starts at character position 3 of the string abcde contained in the string variable $string: $string = "abcdef" $substring = $MID($string, 3, 2) Related Keyword $UNPACK string function eV+Language Reference Guide, v2.x, 18319-000 Rev A Page 340