Welcome

User: Pass:   register


The $mid identifier will return M characters starting from position N from a string.

Format

$mid(<string>,<N>[,M])

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.

Properties

None.

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.

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

Hacks

None.

Related Articles

String Handling

Related Commands

None.

Related Events

None.

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






© 1996-2010 hdesk.org and dalnethelpdesk.com