Case-insensitive:
package main
import (
"fmt"
"github.com/itbasis/go-hashtag"
)
func main() {
text := "An example of a text with a #hashtag #another #Another"
hashTags := hashtag.NewParser(false).Parse(text)
fmt.Println(hashTags)
// Output: ["hashtag": 1, "another": 2]
}
Case-sensitive:
package main
import (
"fmt"
"github.com/itbasis/go-hashtag"
)
func main() {
text := "An example of a text with a #hashtag #another #Another"
hashTags := hashtag.NewParser(true).Parse(text)
fmt.Println(hashTags)
// Output: ["hashtag": 1, "another": 1, "Another": 1]
}