You've already forked SharedScripts
mirror of
https://github.com/jaapbrasser/SharedScripts.git
synced 2026-04-18 19:01:56 +02:00
Added convertto-Morse function 🆕
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
function ConvertTo-Morse {
|
||||
param(
|
||||
[string] $InputObject
|
||||
)
|
||||
|
||||
$Morse = @{
|
||||
0 = '-----'
|
||||
1 = '.----'
|
||||
2 = '..---'
|
||||
3 = '...--'
|
||||
4 = '....-'
|
||||
5 = '.....'
|
||||
6 = '-....'
|
||||
7 = '--...'
|
||||
8 = '---..'
|
||||
9 = '----.'
|
||||
A = '.- '
|
||||
B = '-...'
|
||||
C = '-.-.'
|
||||
D = '-..'
|
||||
E = '. '
|
||||
F = '..-.'
|
||||
G = '--.'
|
||||
H = '....'
|
||||
I = '.. '
|
||||
J = '.---'
|
||||
K = '-.-'
|
||||
L = '.-..'
|
||||
M = '-- '
|
||||
N = '-.'
|
||||
O = '---'
|
||||
P = '.--.'
|
||||
Q = '--.-'
|
||||
R = '.-.'
|
||||
S = '...'
|
||||
T = '-'
|
||||
U = '..-'
|
||||
V = '...-'
|
||||
W = '.--'
|
||||
X = '-..-'
|
||||
Y = '-.--'
|
||||
Z = '--..'
|
||||
}
|
||||
$InputObject.ToCharArray().ForEach{$Morse[([string]$_)]} -join ' '
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user