Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <cfscript>
- String function rotN(required String inString, Numeric rotations = 13) {
- // Build struct of printable characters.
- q=[] ;
- for (z=1; z<=94; z++) {
- q[z] = chr(z+32) ;
- }
- local.retVal = "";
- // There are 94 printable ASCII characters. First printable is 32 (space). Last printable is 126 (~). (127 is DELETE)
- // Get the current letter for evaluation.
- for ( var i=1; i<=len(arguments.inString); i++ ) {
- // If you want to include space character, start at 32.
- var start = 33 ;
- var x = q.find( mid(arguments.inString,i,1) ) ;
- z = arguments.rotations + start ;
- y = (x>126)?( x%126 )+start : x ;
- writeOutput(
- y
- & " | " & (x)
- & " | " & (x) %126
- & "<br>"
- ) ;
- //retVal &= y ;
- }
- //return retVal ;
- }
- // All printable ASCII characters.
- s = "" ;
- for ( i = 33; i<=126; i++ ) {
- s &= chr(i) ;
- }
- writeOutput(s & "<br>") ;
- writeOutput(rotN("#s#",93)) ;
- writeOutput("<br><br><br>");
- </cfscript>
Add Comment
Please, Sign In to add comment