Add to Technorati Favorites
Welcome to ThePowerShellGuy.com Sign in | Join | Help

Scripting Games 2008 Sudden Death Challenge Event 6

Altought the -replace operator does not support scriptblocks yet ( We keep on begging ;-) ) ,

the Switch -regex was a nice alternative in this case :  

([string[]][char[]](gc c:\scripts\Lettercase.txt)  |% {
  Switch -regex -casesensitive ($_) {
    '[A-Z]' {$_.tolower()}
    '[a-z]' {$_.toUpper()}
    '\d'    {[int]$_ - 1}
    default {$_}
  }
}) -join ''

Enjoy,

Greetings /\/\o\/\/

Published Thursday, February 28, 2008 6:15 AM by MoW

Comments

# Scripting Games: Sudden Death Challenge - Event 6 « PowerShell ?? ???????????? ??????????????

Anonymous comments are disabled