Skip to content

itbasis/go-hashtag

Repository files navigation

Go HashTag

Library for working with hashtags in the text

GitHub branch checks state GitHub go.mod Go version godoc reference blue GitHub Release codecov Go Report Card

Installation

go get -u github.com/itbasis/go-hashtag@latest

Examples

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]
}

About

Library for working with hashtags in the text

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •