From WikiChip
$mid Identifier - mIRC
Commands & Identifiers
Basics
Events
Matching Tools
Data Storage
Control Structures
GUI Scripting
Sockets
Advanced Scripting
Additional Resources
Security
Other
$mid is a string manipulation identifier used to return a sub-string portion of a string.
Synopsis
- $mid(<text> ,S [, N ] )
Parameters
- text String from which to return a portion
- S Position within Text. If S is negative, position is relative to the end of Text instead of the beginning. Using Zero behaves same as position 1.
- N Optional Length. If Length parameter not used, returns entire remainder of the string. If N is zero, returns the numeric length of the string. If N is negative, returns the string beginning at position S except for the LAST $Abs(N) characters.
Properties
None
Examples
//echo -a $mid(abcdefghij,2,3) returns 3 characters beginning at position 2
//echo -a $mid(abcdefghij,2) //echo -a $mid(abcdefghij,2,9999) both return ALL characters beginning at position 2. Omitting N avoids the need to use N as a too-large number like 9999
//echo -a $mid(abcdefghij,-6,2) returns 2 characters beginning at position 6th from the end. Is equivalent to: //echo -a $left($right(abcdefghij,6) ,2)
//echo -a $mid(abcdefghij,-6) returns ALL characters beginning at position 6th from the end.
//echo -a $mid(abcdefghij,3,-2) returns ALL characters beginning at position 3 EXCEPT for the last 2 characters.
//echo -a $mid(abcdefghij,3,0) returns the length of the string beginning at position 3.
Compatibility
Added: mIRC v4.5
Added on: 30 Jun 1996
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.