formatifier.go
func ToSSN(theString, delimiter string) (string, error) {
	f := New(theString)
	f.removeNonDigits()

	if f.length != 9 {
		return "", errors.New("string needs to be 9 digits for Social Security Numbers")
	}

	var buffer bytes.Buffer
	count := 0

	for _, i := range f.theString {
		count++

		buffer.WriteString(string(i))

		if count == 3 || count == 5 {
			buffer.WriteString(delimiter)
		}
	}
	return buffer.String(), nil
}
func ToSSN(theString, delimiter string) (string, error) {
	f := New(theString)
	f.removeNonDigits()

	if f.length != 9 {
		return "", errors.New("string needs to be 9 digits for Social Security Numbers")
	}

	var buffer bytes.Buffer
	count := 0

	for _, i := range f.theString {
		count++

		buffer.WriteString(string(i))

		if count == 3 || count == 5 {
			buffer.WriteString(delimiter)
		}
	}
	return buffer.String(), nil
}
func ToSSN ( theString , delimiter string ) ( string , error ) { f := New ( theString ) f . removeNonDigits ( ) if f . length != 9 { return " " , errors . New ( " " ) } var buffer bytes . Buffer count := 0 for _ , i := range f . theString { count ++ buffer . WriteString ( string ( i ) ) if count == 3 || count == 5 { buffer . WriteString ( delimiter ) } } return buffer . String ( ) , nil }
// ToSSN will format the provided string as a SSN.
ToSSN will format the provided string as a SSN .