Thursday, August 28, 2014

I keep losing bits of code that do this. I like to make my brain work while it reads. I get bored with the act of reading quickly sometimes. This puts a complete halt to the boredom/lack of challenge.


$filename = "C:\Users\Ogre\Documents\Calibre Library\Catch-22\Joseph Heller (30)\Joseph Heller - Catch-22.txt"
$text = [System.IO.File]::ReadAllText($filename);
$output = ""
for($i = 0; $i -lt $text.Length; $i++){
 $currentAsciiValue = [int]$text[$i];
 
 if($currentAsciiValue -gt 64 -and $currentAsciiValue -lt 91) {
  $output += [char]($currentAsciiValue + 1)
 } elseif($currentAsciiValue -gt 96 -and $currentAsciiValue -lt 123) {
  $output += [char]($currentAsciiValue + 1)
 } else {
  $output += [char]($currentAsciiValue)
 }
}
$output >> Catch22Ciphered.txt