$posi

By Pwntage`Ninja on Jun 12, 2007

I made this small identifier so that you can retrieve the Nth character ($2) in a string of text ($1).

I didn't see an identifier in the help file for this, so I decided to make it, because it would make parsing through a single word/nick, character by character, easier.

Someone asked me to demonstrate it, so I made a quite pointless snippet that replaces the first vowel in a nickname with the l33t speak version of the vowel. Sadly, I couldn't find one for U that was on character, heh.

alias vowel {
  unset %i %m %d
  If (a !isin $1-) && (e !isin $1-) && (i !isin $1-) && (o !isin $1-) { return $1 }
  While ($posi($1-,%i)) {
    unset %m
    If ($posi($1-,%i) isin aeio) { %m = $replace($posi($1-,%i),a,4,e,3,i,1,o,0) }
    If (%m = $null) { %m = $posi($1-,%i) }
    %d = $iif(%d,%d $+ %m,%m)
    If (%m isin 4310) { goto end }
    inc %i
  }
  :end
  return %d $+ $right($1-,$calc($len($1-) - $len(%d)))
}

That is how a $posi could be used.

alias posi {
  If (!$2) || ($2 !isnum) { var %r $null }
  var %r $right($left($1,$2),1)
  return %r
}

Comments

Sign in to comment.
Pwntage`Ninja   -  Jun 13, 2007

kersett: So if they don\'t specify a $2 value, I should just let the alias evaulate without the needed $2 value? Nosir, it needs to be in there.

Russel, reread the description, though I might try that thing with the \'y\' on a rainy day.

 Respond  
kerstt   -  Jun 13, 2007

$2 isnot a number if its $null so u can leave if (!$2) just if ($2 !isnum)

 Respond  
RusselB   -  Jun 13, 2007

In your code with the vowels, you missed the vowel u and the switchable consonant/vowel y. How you would determine if y should be a consonant or a vowel is something for you to try.

 Respond  
Pwntage`Ninja   -  Jun 12, 2007

Damn <_<

Why do I always overlook the ones I know =(

-Suicides-

<3 Though :P

 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.