// parseFreq parses val as a frequency.
// Accepts strings.
parseFreq parses val as a frequency.
Accepts strings.
// parseFreq parses val as a frequency . // Accepts strings .
func parseFreq(val interface{}) (hertz, error) {
	s, ok := val.(string)
	if !ok {
		return 0, errors.New("cannot parse as frequency")
	}
	s = strings.ToLower(s)
	if !strings.HasSuffix(s, "hz") {
		return 0, errors.New("cannot parse as frequency")
	}
	freq, err := strconv.ParseFloat(s[:len(s)-2], 64)
	if err != nil {
		return 0, err
	}
	return hertz(freq), nil
}
func parseFreq ( val interface { } ) ( hertz , error ) { s , ok := val . ( string ) if ! ok { return 0 , errors . New ( " " ) } s = strings . ToLower ( s ) if ! strings . HasSuffix ( s , " " ) { return 0 , errors . New ( " " ) } freq , err := strconv . ParseFloat ( s [ : len ( s ) - 2 ] , 64 ) if err != nil { return 0 , err } return hertz ( freq ) , nil }
parseFreq parses val as a frequency.
parseFreq parses val as a frequency .