stringutil

package
v0.0.0-...-25b8d04 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CharCount

func CharCount(str string) int

CharCount returns number of char in str.

func CreateAbsoluteURL

func CreateAbsoluteURL(url string, base *nurl.URL) string

CreateAbsoluteURL convert url to absolute path based on base. However, if url is prefixed with hash (#), the url won't be changed.

func EqualsIgnoreCase

func EqualsIgnoreCase(str1, str2 string) bool

EqualsIgnoreCase checks if two string is similar in case-insensitive mode.

func HasPrefixIgnoreCase

func HasPrefixIgnoreCase(str, prefix string) bool

HasPrefixIgnoreCase checks if str is stared with prefix in case-insensitive mode.

func IsStringAllDigit

func IsStringAllDigit(str string) bool

func IsStringAllWhitespace

func IsStringAllWhitespace(str string) bool

func UnescapedString

func UnescapedString(u *nurl.URL) string

Types

type FastWordCounter

type FastWordCounter struct{}

func (FastWordCounter) Count

func (c FastWordCounter) Count(text string) int

type FullWordCounter

type FullWordCounter struct{}

func (FullWordCounter) Count

func (c FullWordCounter) Count(text string) int

type LetterWordCounter

type LetterWordCounter struct{}

func (LetterWordCounter) Count

func (c LetterWordCounter) Count(text string) int

type WordCounter

type WordCounter interface {
	Count(string) int
}

WordCounter is object for counting the number of words. For some languages, doing this relies on non-trivial word segmentation algorithms, or even huge look-up tables. However, for our purpose this function needs to be reasonably fast, so the word count for some languages would only be an approximation. Read https://crbug.com/484750 for more info.

func SelectWordCounter

func SelectWordCounter(text string) WordCounter

SelectWordCounter picks the most suitable WordCounter depending on the specified text.

Jump to

Keyboard shortcuts

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