exercism/go/say/say.go

40 lines
762 B
Go
Raw Normal View History

2016-08-13 23:20:14 +00:00
package say
import (
"fmt"
"strconv"
)
func Say(num int) string {
// Tens place gives us the y-nums (twent_y-num, thirt_y-num, etc)
//tens := num % 100
/*
switch tens - (tens%10)/10 {
case tens > 10:
switch tens % 10 {
case 1:
return Say(num-tens) + " eleven"
case 2:
return Say(num-tens) + " twelve"
case 3:
return Say(num-tens) + " thirteen"
case 4:
return Say(num-tens) + " fourteen"
case 5:
return Say(num-tens) + " fifteen"
default:
return Say(num-tens) + " " + Say(tens%10) + "teen"
}
}
*/
return ""
}
func GetPlaceValue(num, place int) int {
fmt.Println("Testing " + strconv.Itoa(place) + "s place of " + strconv.Itoa(num))
if num > place {
return num - (num%place)/place
}
return 0
}