Page Menu
Home
Musing Studio
Search
Configure Global Search
Log In
Files
F10669855
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
630 B
Subscribers
None
View Options
diff --git a/tags/tags.go b/tags/tags.go
new file mode 100644
index 0000000..b980eb5
--- /dev/null
+++ b/tags/tags.go
@@ -0,0 +1,22 @@
+package tags
+
+import (
+ "github.com/kylemcc/twitter-text-go/extract"
+)
+
+func Extract(body string) []string {
+ matches := extract.ExtractHashtags(body)
+ tags := map[string]bool{}
+ for i := range matches {
+ // Second value (whether or not there's a hashtag) ignored here, since
+ // we're only extracting hashtags.
+ ht, _ := matches[i].Hashtag()
+ tags[ht] = true
+ }
+
+ resTags := make([]string, 0)
+ for k := range tags {
+ resTags = append(resTags, k)
+ }
+ return resTags
+}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Fri, May 16, 6:06 PM (1 d, 13 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3240303
Attached To
rWC Write.as Web Core
Event Timeline
Log In to Comment