Created
July 17, 2020 21:28
-
-
Save Noy/df6cf35ef721fc2e8c0602efe2fa6329 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"strings" | |
) | |
func main() { | |
log.Println(checkCard("d2")) | |
} | |
func checkCard(card string) bool { | |
if len(card) != 2 { | |
return false | |
} | |
cardValues := []string{"2", "3", "4", "5", "6", "7", "8", "9", "T", "J", "Q", "K", "A"} | |
cardSuits := []string{"s", "c", "h", "d"} | |
for _, cV := range cardValues { | |
if strings.Contains(card, cV) { | |
for _, cS := range cardSuits { | |
if strings.Contains(card, cS) { | |
return true | |
} | |
} | |
} | |
} | |
return false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment