Skip to content

Instantly share code, notes, and snippets.

@thiagozs
Created October 24, 2020 12:42
Show Gist options
  • Save thiagozs/9c0289ace38844ea406fdaf259a9452c to your computer and use it in GitHub Desktop.
Save thiagozs/9c0289ace38844ea406fdaf259a9452c to your computer and use it in GitHub Desktop.
String check with equal fold
package main
import (
"fmt"
"strings"
)
var (
ASK_SIDE = "ask"
BID_SIDE = "bid"
)
func main() {
side := "BiD"
switch {
case strings.EqualFold(side, BID_SIDE):
fmt.Println("switch bid_side:", BID_SIDE)
case strings.EqualFold(side, ASK_SIDE):
fmt.Println("switch ask_side:", ASK_SIDE)
default:
fmt.Println("unknown:", side)
return
}
fmt.Println("Hello, playground")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment