Created
February 7, 2020 07:42
-
-
Save shiopon01/9fc3bce0b027c6079653023cda71ae28 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 ( | |
"fmt" | |
) | |
type Hoges []struct { | |
value string | |
} | |
func (h *Hoges) Filter(item string) bool { | |
for i := 0; i < len(*h); i++ { | |
if (*h)[i].value == item { | |
return true | |
} | |
} | |
return false | |
} | |
func main() { | |
sample := Hoges{{"a"}, {"b"}, {"c"}} | |
fmt.Println(sample.Filter("c")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment