strings

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RootRune rune = 9999
	MaxLen   int  = 50
)

Set default root value

View Source
const MobileReg = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(16[0-9])|(18[0-9])|(17[0-9]))\\d{8}$"

MobileReg define mobile regex

Variables

This section is empty.

Functions

func GetImprovedNext

func GetImprovedNext(pattern []rune) []int

GetImprovedNext improved method for Next

func GetNext

func GetNext(pattern []rune) []int

GetNext is get the next array of KMP

func IsValidMobile

func IsValidMobile(mobileNo string) bool

IsValidMobile returns a string is a phone No. or not

func KMPImprovedSearch

func KMPImprovedSearch(content string, pattern string) int

KMPImprovedSearch improved kmp search

func KMPSearch

func KMPSearch(content string, pattern string) int

KMPSearch search substring by KMP algorithm

func NewUUID

func NewUUID(t UUIDType) (string, error)

NewUUID is a func that create a new uuid and returns

func Reverse

func Reverse(s string) string

Reverse return a reserved string

func SundaySearch

func SundaySearch(content string, pattern string) int

SundaySearch is search by Sunday

Types

type Trie

type Trie struct {
	Root *TrieNode
	// MaxLevel is the max leve of trie tree.
	MaxLevel int
}

Trie tree model,started with root node

func NewTrie

func NewTrie() Trie

NewTrie is a new func for a trie tree

func (*Trie) FindAllExisted

func (t *Trie) FindAllExisted(content string) []string

FindAllExisted get all existed content and return

func (*Trie) InsertKey

func (t *Trie) InsertKey(key string)

InsertKey is a func that insert key into the trie tree

func (*Trie) IsExisted

func (t *Trie) IsExisted(content string) (bool, int, string)

IsExisted is a func that return the existed key

type TrieNode

type TrieNode struct {
	Children map[rune]*TrieNode
	End      bool
	Value    rune
}

TrieNode is trie node model

func NewTrieNode

func NewTrieNode(value rune) *TrieNode

NewTrieNode is a new func for a trie node

type UUIDType

type UUIDType int

UUIDType define uuid display type ,int

const (
	UUIDTypeHashLike UUIDType = iota
	UUIDTypeCanonical
)

define the uuid types

Jump to

Keyboard shortcuts

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