Hi,
I have the following Go type.
```
type weekday string
const (
Monday weekday = "Monday"
Tuesday = "Tuesday"
.
.
.
)
```
Now I have a function that receives a string parameter and I want to
evaluate if it s a valid weekday or not. Say:
```
func handler(w http.ResponseWriter, r *http.Request) {
// Parse req.body and get a day string
day := "Tuesday" // Valid day
day := "tuesday" // Invalid day
day := "123819283" // Invalid day
}
```
I want to evaluate if the string variable `day` is one of the valid
permitted values for the [Ww]eekday custom type. What is the recommended /
right go way of doing this ?
Thanks.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.