util

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2022 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeriveEmojisFromText

func DeriveEmojisFromText(text string) []string

DeriveEmojisFromText takes a plaintext (ie., not html-formatted) text, and applies a regex to it to return a deduplicated list of emojis used in that text, without the surrounding `::`

func DeriveHashtagsFromText

func DeriveHashtagsFromText(text string) []string

DeriveHashtagsFromText takes a plaintext (ie., not html-formatted) text, and applies a regex to it to return a deduplicated list of hashtags used in that text, without the leading #. The case of the returned tags will be lowered, for consistency.

func DeriveMentionNamesFromText added in v0.2.2

func DeriveMentionNamesFromText(text string) []string

DeriveMentionNamesFromText takes a plaintext (ie., not html-formatted) text, and applies a regex to it to return a deduplicated list of account names mentioned in that text, in the format "@user@example.org" or "@username" for local users.

func ExtractMentionParts

func ExtractMentionParts(mention string) (username, domain string, err error)

ExtractMentionParts extracts the username test_user and the domain example.org from a mention string like @test_user@example.org.

If nothing is matched, it will return an error.

func UniqueStrings

func UniqueStrings(s []string) []string

UniqueStrings returns a deduplicated version of a given string slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL