40 lines
762 B
Go
40 lines
762 B
Go
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
|
|
}
|