I'm sure English would be sufficient, given the weekday and month
names are only in English.
It's pretty easy to write it yourself. Something like this:
// only works for 1-31.
func ordinal(x int) string {
suffix := "th"
switch x {
case 1, 21, 31: suffix = "st"
case 2, 22: suffix = "nd"
case 3, 23: suffix = "rd"
}
return strconv.Itoa(x) + suffix
}
Dave.
On Tuesday, 14 February, 2012 at 7:37 AM, David Symonds wrote:
It's pretty easy to write it yourself. Something like this:// only works for 1-31.func ordinal(x int) string {suffix := "th"switch x {case 1, 21, 31: suffix = "st"case 2, 22: suffix = "nd"case 3, 23: suffix = "rd"}return strconv.Itoa(x) + suffix}
// only works for 1-31.func ordinal(x int) string {suffix := "th"switch x {case 1, 21, 31: suffix = "st"case 2, 22: suffix = "nd"case 3, 23: suffix = "rd"}return strconv.Itoa(x) + suffix}
12nd?
Of course no, go ahead.
I'm sure English would be sufficient, given the weekday and month
names are only in English.
It's pretty easy to write it yourself. Something like this:
// only works for 1-31.
func ordinal(x int) string {
suffix := "th"
switch x {
case 1, 21, 31: suffix = "st"
case 2, 22: suffix = "nd"
case 3, 23: suffix = "rd"
}
return strconv.Itoa(x) + suffix
}
Dave.
I'm not so sure of that ... Go is the first UTF8-based language.
In my point of view , begin with english is obviously a pretty good choice but stay stuck on only one language is a terrible mistake.So no 1st, 2nd, 3rd, etc ... is not sufficient for everyone because names are not only in English. But that's a good start ...
> So no 1st, 2nd, 3rd, etc ... is not sufficient for everyone because names
> are not only in English. But that's a good start ...
You missed my point. If you're trying to use this with the "time"
package in the standard library then you're already being stuck with
English names for weekdays and months, so just doing English ordinals
isn't making the situation worse.
Dave.
Haskell supports Unicode too.
main = do
let ωmega = 3
print ωmega
is valid, whereas
main = do
let Ωmega = 3
print Ωmega
is not (variables/functions are lowercase, type names are uppercase).uppercase.
Rémy.
On Tuesday, February 14, 2012 2:29:18 PM UTC-8, Guillaume Lescure wrote:I'm not so sure of that ... Go is the first UTF8-based language.I don't believe this to be true.
In my point of view , begin with english is obviously a pretty good choice but stay stuck on only one language is a terrible mistake.So no 1st, 2nd, 3rd, etc ... is not sufficient for everyone because names are not only in English. But that's a good start ...I'd welcome an internationalization effort of github.com/dustin/go-humanize. :)
Haskell supports Unicode too.
main = do
let ωmega = 3
print ωmegais valid, whereas
main = do
let Ωmega = 3
print Ωmegais not (variables/functions are lowercase, type names are uppercase).uppercase.
Rémy.
You missed my point. If you're trying to use this with the "time"
package in the standard library then you're already being stuck with
English names for weekdays and months, so just doing English ordinals
isn't making the situation worse.
Dave.