This blog has moved to http://ThePowerShellGuy.com
Greetings /\/\o\/\/
I'v been a bit busy this week,As I prepared for my first Monad presention I did at work today,
and did join the
2006 Winter Scripting Games – February 13 - 24 as I mentioned earlier.
the games are realy nice to do (even in VBscript), also to remember how handy MSH would be to do the same,
as MSH is not a Official Script games language yet (I hope we will be allowed in next games),
I will do some of the events the monad way here , as the answers of the first event are posted on the Scripting Games page I will do some of those scipts here in MSH (complete scripts):
to follow them (see the original script and explanations ) you can check the
Answer: ScriptathalonQuestion 1.("Sunday", "Monday", "Sundae", "Tuesday", "Sunshine") -match "sun"
Sunday
Sundae
Sunshine
Question 2.([datetime]"2/1/2006").adddays(5).ToShortDateString()
2/6/2006
Question 3.$values = 1, 2, 3, 4 ,5, 6, 7, 8, 9
for ($i=0 ; $i -lt $values.Length ; $i+=2) {$values[$i]}
1
3
5
7
9
Question 4.[int](2721/13)
209
Question 5.(66/100).tostring("p0")
66 %
Ok, this could take some extra explaining for some help on this one see :http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconstandardnumericformatstrings.aspQuestion 6("A", "B", "C", "D", "E") foreach {[int][char]$_}
65
66
67
68
69
Question 7.(8, 9, 10, 11, 12) foreach {$_.tostring("x")}
8
9
a
b
c
(see question 5 )Question 8.[string]::join(" ",("A","B","C","D","E"))
A B C D E
Question 9.$Command = '$a = 1' + "`n"$Command += '$b = 2' + "`n"$Command += '$a+$b'invoke-command $Command
3
Question 10.$string = "This is a test string."
$a = $string.ToCharArray()
[array]::reverse($a)
[string]::join("",$a)
.gnirts tset a si sihT
Ok, I needed 3 lines for the last one (could only find a reverse function on the array type) , but the rest of the scripts not fixed with one line, but replaced by one line.
gr /\/\o\/\/
Tags : Monad msh