Skip to content

Instantly share code, notes, and snippets.

@davidbegin
Created April 7, 2022 03:34
Show Gist options
  • Save davidbegin/3f73bfc48aed70b484e81240b5617faf to your computer and use it in GitHub Desktop.
Save davidbegin/3f73bfc48aed70b484e81240b5617faf to your computer and use it in GitHub Desktop.
Text to Frank script
package main
import (
"flag"
"fmt"
"strings"
"github.com/alwindoss/morse"
)
func main() {
input := flag.String("input", "I only love frank", "What you would like to convert to frank speech.")
flag.Parse()
userInput := string(*input)
fmt.Printf("\n\t Original: %s\n", userInput)
h := morse.NewHacker()
morseCode, _ := h.Encode(strings.NewReader(userInput))
fmt.Printf("\nMorse Code: %s\n", morseCode)
result := strings.ReplaceAll(string(morseCode), ".", "frank")
second := strings.ReplaceAll(result, "-", "FRANK")
final := strings.ReplaceAll(second, "/", "")
fmt.Printf("\n\n\tResult: %s", final)
}
Copy link

ghost commented Apr 14, 2022

FRANKfrank frankfrank FRANKfrankFRANKfrank frank frankFRANKfrankFRANKfrankFRANK frankFRANKfrankFRANKfrankFRANK frankFRANKfrankFRANKfrankFRANK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment