$reverse

By Gex on Mar 03, 2006

this alias will let you reverse the text..
usage $reverse(text)
eg: $reverse(text) will return "txet"

alias reverse {
  var %x = $len($1) ,%m = $1
  while (%x) {
    var %y = $+(%y,$mid(%m,%x,1),$chr(32))
    dec %x
  }
  return %y
}

Comments

Sign in to comment.
Gex   -  Mar 04, 2006

yes i $removed it :P thanks

 Respond  
xDaeMoN   -  Mar 04, 2006

There is no need for the $remove.

 Respond  
Gex   -  Mar 04, 2006

its fixed now

 Respond  
Gex   -  Mar 04, 2006

xdaemon yes i know it will reverse one word only and if there is spaces it will make the 2 words stuck to each other....in fact thats what i needed in a script i was making and i posted the alias here...its i can use tokenize to fix that...but i didnt need it

 Respond  
Nerd   -  Mar 03, 2006

hmm looks very similar to the snippet a friend of mine made
alias reverse {
var %o = $len($1-),%i
while (%o) {
%i = $+(%i,$replace($mid($1-,%o,1),$chr(32),$chr(160)))
dec %o
}
if ($isid) return %i
else say %i
}
therefore i think it works ;)

 Respond  
xDaeMoN   -  Mar 03, 2006

Works fine if you only have 1 word, but if you put spaces in it, will not work properly.

Check this thread regarding that problem: http://www.hawkee.com/phpBB2/viewtopic.php?t=6281

 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.