Try use this script code that creates the identifier "$fsub" you need:
Code
alias fsub {
  if ($4 isnum && $3 isnum && $3 > 0 && $3 <= $pos($1,$2,0)) {
    if ($4 > 0) var %pos $calc($pos($1,$2,$3) + $len($2))
    if ($4 < 0) var %p $pos($1,$2,$3), %pos $calc(%p $4)
    if (%p && %pos < 1) return $left($1,$calc(%p -1))
    if (%pos <= $len($1)) return $mid($1,%pos,$abs($4))
  } | return 0
}

Syntax: $fsub(string, substring, index N, letters N)

Example: $fsub(helloworld, llo, 1, 5)

Test commands:
Code
//echo -a $fsub(AnApplicationCanBeUsedToFindContinuationOfData,CanBe,1,4)
//echo -a $fsub(AnApplicationCanBeUsedToFindContinuationOfData,tion,2,5)
//echo -a $fsub(AnApplicationCanBeUsedToFindContinuationOfData,tion,2,-5)

Returns:

  1. Used
  2. OfDat
  3. tinua



Note: In all other cases, when incorrect or invalid values are used in the parameters, the identifier will return the number "0".


🌐 https://forum.epicnet.ru 📜 irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples