https://github.com/0xleif/morse
- --- / .- -. -.. / ..-. .-. --- -- / -- --- .-. ... . / .. -. / ... .-- .. ..-. -
https://github.com/0xleif/morse
morse swift
Last synced: 6 months ago
JSON representation
- --- / .- -. -.. / ..-. .-. --- -- / -- --- .-. ... . / .. -. / ... .-- .. ..-. -
- Host: GitHub
- URL: https://github.com/0xleif/morse
- Owner: 0xLeif
- Created: 2021-01-20T01:14:43.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-02-23T00:06:12.000Z (over 4 years ago)
- Last Synced: 2025-02-10T23:41:47.239Z (8 months ago)
- Topics: morse, swift
- Language: Swift
- Homepage: https://en.wikipedia.org/wiki/Morse_code
- Size: 4.88 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Morse
To and from morse in Swift.
## Example
### Hello, World!
```swift
"Hello, World!".toMorse // .... . .-.. .-.. --- --..-- / .-- --- .-. .-.. -.. -.-.--".... . .-.. .-.. --- --..-- / .-- --- .-. .-.. -.. -.-.--".fromMorse // hello, world!
```### Alphabet
```swift
"abcdefghijklmnopqrstuvwxyz"
.map { "\($0): \(String.morseAlphabet[$0] ?? "#")" }
.joined(separator: "\n")/*
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: --..
*/
```