Morse is a simple library for encoding and decoding between morse and text.
This library supports the default morse (as defined by ITU-R M.1677-1) code but custom ones can be used freely using a custom EncodingMap
You can find a simple tool in the cmd/morse directory This tool can be used for converting to/from morse
$ morse > out.morse test this is morse. ^C $ cat out.morse - . ... - .-.-- .... .. ... .. ... -- --- .-. ... . .-.-.- .-.- $ morse -D < out.morse TEST THIS IS MORSE.
For more uses look use --help
text := "MORSE IS AWESOME" //Convert to morse textInMorse := morse.ToMorse(text) fmt.Println(textInMorse) //-- --- .-. ... . .. ... .- .-- . ... --- -- . //Back to text backToText := morse.ToText(textInMorse) fmt.Println(backToText) //MORSE IS AWESOME
You can see more examples on the godoc documentation