Paulie Posted August 15, 2007 Share Posted August 15, 2007 (edited) This basically just transposes all alphabetic characters in a string up 13 places, as implied by the name ROTation-13. Its really simple, but still fun. Enjoy. MsgBox(0, "HELLO:", ROT13("HELLO:"));Returns "URYYB:" Func ROT13($String) $Letters = StringSplit($String, "") Local $Result = "" For $a = 1 to $Letters[0] $Char = TransChr($Letters[$a]) $Result&=$Char Next Return $Result EndFunc Func TransChr($Chr) If StringRegExp($Chr, "[a-z]") Then $Lower = StringSplit("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz","") For $i = 1 to 26 If $Chr = $Lower[$i] Then Return $Lower[$i+13] EndIf Next ElseIf StringRegExp($Chr, "[A-Z]") Then $Upper = StringSplit("ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ","") For $i = 1 to 26 If $Chr = $Upper[$i] Then Return $Upper[$i+13] EndIf Next Else SetError(1) Return $Chr EndIf EndFunc Edited August 15, 2007 by Paulie Link to comment Share on other sites More sharing options...
WeMartiansAreFriendly Posted August 16, 2007 Share Posted August 16, 2007 Good job. Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet() Link to comment Share on other sites More sharing options...
Bomi Posted August 16, 2007 Share Posted August 16, 2007 (edited) Goodie I've been looking for something like this Edited August 16, 2007 by Bomi Link to comment Share on other sites More sharing options...
Joke758 Posted August 16, 2007 Share Posted August 16, 2007 Nice, I made one a while ago. Func _Rot13( $sWord ) Local $sOriginal = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" Local $sNew = "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm" Local $sRet For $i = 1 to StringLen ( $sWord ) $iPos = StringInStr ( $sOriginal, StringMid ( $sWord, $i, 1 ), 1 ) If $iPos <> 0 Then $sRet = $sRet & StringMid ( $sNew, $iPos, 1 ) Else $sRet = $sRet & StringMid ( $sWord, $i, 1 ) EndIf Next Return $sRet EndFunc A little faster than yours. [u]My Programs:[/u]Word Search Creator - Make your own Word SearchShortHand - Hide a secret message in a jpg fileHex Editor - Edit your Binary fileIncrease file size - Increase the size of any filesArt Generator - A program that generate random picture[u]My Functions:[/u]16-Bits Hash - My Hash function similar to MD5Probabilities - My probabilities function (factorial, permuation, combination)_GetDate() - Convert a date to a day of the week_Base(), _Dec() - Convert a number in any base (bin, oct, hex, dec). Create your own! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now