Welcome
The $mid identifier will return M characters starting from position N from a string.
[edit]
Format
$mid(<string>,<N>[,M])
[edit]
Parameters
- <string> The string to work with.
- <N> The position you want to start reading characters from in the string.
- [M] The number of characters to return.
[edit]
Properties
None.
[edit]
Points To Note
If you supply a negative value for N $mid will start at <length of string> - N characters.
If you supply a negative value for M $mid will return characters from position N to position <length of string> - M.
If you don't supply the M parameter $mid will read all characters from position N and onwards.
If you supply 0 as the M paramter $mid will return the number of characters left from the position N and onwards.
[edit]
Examples
//echo -a $mid(hello,2,3)
Output: ell
//echo -a $mid(hello world,-3)
Output: rld
//echo -a $mid(hello world,-7,-3)
Output: o wo
//echo -a $mid(hello world,3,0)
Output: 9
[edit]
Hacks
None.
[edit]
Related Articles
[edit]
Related Commands
None.
[edit]
Related Events
None.
[edit]
Related Identifiers
$count, $left, $len, $pos, $poscs, $right
| Text and Number Identifiers |
|---|
| $abs • $acos • $and • $asc • $asin • $atan • $base • $biton • $bitoff • $bytes • $calc • $ceil • $chr • $compress • $cos • $count • $decode • $decompress • $encode • $floor • $int • $isbit • $islower • $isupper • $left • $len • $log • $longip • $lower • $mid • $noqt • $not • $or • $ord • $pos • $poscs • $qt • $rand • $remove • $removecs • $replace • $replacecs • $replacex • $replacexcs • $right • $round • $sin • $sqrt • $str • $strip • $stripped • $tan • $upper • $wrap • $xor |