stringutil

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2019 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BeautifyFilename

func BeautifyFilename(fn string) string

BeautifyFilename takes a filename and attempts to turn it into a readable form, as TitleCase natural language, suitable for the top level of a Document.

func Conjoin

func Conjoin(conj string, items []string) string

Conjoin returns "Suzzane, Fatima and Brian" from string of items.

func EscapeHTMLcomplexChars

func EscapeHTMLcomplexChars(s string) string

EscapeHTMLcomplexChars looks for "complex" characters within HTML and replaces them with the HTML escape codes which describe them. "Complex" characters are those encoded in more than one byte by UTF8.

func EscapeHTMLcomplexCharsByte

func EscapeHTMLcomplexCharsByte(b []byte) []byte

EscapeHTMLcomplexCharsByte looks for "complex" characters within HTML and replaces them with the HTML escape codes which describe them. "Complex" characters are those encoded in more than one byte by UTF8.

func MakeInitials

func MakeInitials(firstname, lastname string) string

MakeInitials returns user initials from firstname and lastname.

func MakeSlug

func MakeSlug(str string) string

MakeSlug creates a slug, suitable for use in a URL, from a string

func Words

func Words(ch HTML, inSqBr int, testMode bool) ([]string, int, error)

Words returns a slice of words, where each word contains no whitespace, and each item of punctuation is its own word. This functionality is provided to enable verification of the text extraction algorithm across different implemntations.

Types

type HTML

type HTML string

HTML describes a chunk of HTML, Text() method returns plain text.

func (HTML) Text

func (ch HTML) Text(isTest bool) (string, error)

Text returns only the plain text elements of the HTML Chunk, concatanated with "\n", for use in the TOC or for text indexing.

Jump to

Keyboard shortcuts

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