slug

package module
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2021 License: GPL-2.0 Imports: 4 Imported by: 0

README

slug

Support

Please consider donating at PayPal: https://www.paypal.me/jismithpp

Example

package main

import (
	"fmt"

	slug "github.com/theTardigrade/golang-slug"
)

func main() {
	s := slug.GetWithOptions("!=this is a test=!", &slug.Options{
		MaxLen:        12,
		Replacement:   "_",
		RunesToRemove: []rune{'=', '!'},
	})

	fmt.Println(s) // prints "this_is_a_te"
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultOptions = Options{
		MaxLen:        defaultOptionsMaxLen,
		Replacement:   defaultOptionsReplacement,
		RunesToRemove: defaultOptionsRunesToRemove(),
	}
)

Functions

func Get

func Get(text string) (slug string)

func GetWithOptions

func GetWithOptions(text string, options *Options) (slug string)

Types

type Options

type Options struct {
	MaxLen        int
	Replacement   string
	RunesToRemove []rune
}

Jump to

Keyboard shortcuts

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