We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e5a5d63 commit 73bffefCopy full SHA for 73bffef
tags/tags.go
@@ -0,0 +1,22 @@
1
+package tags
2
+
3
+import (
4
+ "github.com/kylemcc/twitter-text-go/extract"
5
+)
6
7
+func Extract(body string) []string {
8
+ matches := extract.ExtractHashtags(body)
9
+ tags := map[string]bool{}
10
+ for i := range matches {
11
+ // Second value (whether or not there's a hashtag) ignored here, since
12
+ // we're only extracting hashtags.
13
+ ht, _ := matches[i].Hashtag()
14
+ tags[ht] = true
15
+ }
16
17
+ resTags := make([]string, 0)
18
+ for k := range tags {
19
+ resTags = append(resTags, k)
20
21
+ return resTags
22
+}
0 commit comments