From WikiChip
$pos Identifier - mIRC
< mirc‎ | identifiers
Revision as of 14:23, 1 February 2018 by Maroonbells (talk | contribs) (Create content for empty page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

$pos returns the case-insensitive position of the Nth substring within a text string. See $poscs for the case-sensitive version.

Synopsis

$pos(text,substring [,N] )

Parameters

 %var/text The string being searched
substring The string being searched for within text string
N The Nth occurrence of substring being searched for. Default is 1 if parameter not used.

  • Note: N=0 returns count of string's occurrences. Returns $null if Nth substring not found.

Switches

None

Examples

//echo -a $pos(DEADBEEF,E)
returns: 2 (search is case-insensitive) (Default N=1 when 3rd parameter isn't used)
//echo -a $pos(DEADBEEF,e,2)
returns: 6
//echo -a $pos(DEADBEEF,e,0)
returns: 3 (count of letter 'e')
//echo -a $pos(deadbeef,db,1)
returns: 4
//echo -a $pos(DEADBEEF,x,0)
returns: $null (not found)
//var %a a $chr(32) b | echo -a The string has length $len(%a) and contains $pos(%a,$chr(32),0) spaces
//echo -a The path-less filename is $mid($mircexe, $calc(1+$pos($mircexe,\, $count($mircexe,\) ) ) )

Compatibility

Added: mIRC v4.52
Added on: 06 Jul 1996
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.


See also