You've already forked SharedScripts
mirror of
https://github.com/jaapbrasser/SharedScripts.git
synced 2025-12-24 21:51:38 +02:00
46 lines
700 B
PowerShell
46 lines
700 B
PowerShell
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 ' '
|
|
|
|
} |