formatifier.go
func ToLeet(theString string) (string, error) {
	f := New(theString)

	if f.length < 1 {
		return "", errors.New(lengthError)
	}

	f.makeLower()

	words := strings.Fields(f.theString)
	var buffer bytes.Buffer

	for _, word := range words {
		key := string(word)
		if _, ok := leet[word]; ok {
			buffer.WriteString(leet[key][0] + " ")
		} else {
			for _, i := range word {
				letter := string(i)
				if _, ok := leet[letter]; ok {
					buffer.WriteString(leet[letter][0])
				}
			}
			buffer.WriteString(" ")
		}
	}
	return buffer.String(), nil
}
func ToLeet(theString string) (string, error) {
	f := New(theString)

	if f.length < 1 {
		return "", errors.New(lengthError)
	}

	f.makeLower()

	words := strings.Fields(f.theString)
	var buffer bytes.Buffer

	for _, word := range words {
		key := string(word)
		if _, ok := leet[word]; ok {
			buffer.WriteString(leet[key][0] + " ")
		} else {
			for _, i := range word {
				letter := string(i)
				if _, ok := leet[letter]; ok {
					buffer.WriteString(leet[letter][0])
				}
			}
			buffer.WriteString(" ")
		}
	}
	return buffer.String(), nil
}
func ToLeet ( theString string ) ( string , error ) { f := New ( theString ) if f . length < 1 { return " " , errors . New ( lengthError ) } f . makeLower ( ) words := strings . Fields ( f . theString ) var buffer bytes . Buffer for _ , word := range words { key := string ( word ) if _ , ok := leet [ word ] ; ok { buffer . WriteString ( leet [ key ] [ 0 ] + " " ) } else { for _ , i := range word { letter := string ( i ) if _ , ok := leet [ letter ] ; ok { buffer . WriteString ( leet [ letter ] [ 0 ] ) } } buffer . WriteString ( " " ) } } return buffer . String ( ) , nil }
// ToLeet will format the provided string in Leet Speak.
// TODO(briandowns) Make select post match random.
ToLeet will format the provided string in Leet Speak . TODO ( briandowns ) Make select post match random .