$lookfor

By PoiXon on Mar 21, 2005

Simple Snippet may be useful in a script, Use: $lookfor(letter,word) and it will return the number of spaces it moves forward to find the first number.... E.g. $lookfor(e,ape) That Would Return 3 because it moved 3 places forward to find the e in ape. =p, I Dont "think" there is a command that does this

alias lookfor {
  if ($1 !isin $2) { 
    return 0
  }
  elseif ($1 isin $2) {
    var %a 1
    while ($1 !isin $left($2,%a)) {
      inc %a 
    }
    if ($1 isin $left($2,%a)) {
      return %a
    }
  }
}

Comments

Sign in to comment.
PoiXon   -  Mar 22, 2005

ahh, i had no clue =S lol

 Respond  
Relinsquish   -  Mar 21, 2005

Sorry to burst your bubble but $pos(text,string,N) does the same thing. Interesting way of doing it though.

 Respond  
xDaeMoN   -  Mar 21, 2005

$findtok is almost the same but a delimiter is needed. Nice code Poixon.

 Respond  
xDaeMoN   -  Mar 21, 2005

There is, $findtok.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.