community: github.com/documize/community/core/stringutil Index | Files

package stringutil

import "github.com/documize/community/core/stringutil"

Index

Package Files

beautify.go conjoin.go html.go initials.go slug.go words.go

func BeautifyFilename Uses

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 Uses

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

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

func EscapeHTMLcomplexChars Uses

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 Uses

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 Uses

func MakeInitials(firstname, lastname string) string

MakeInitials returns user initials from firstname and lastname.

func MakeSlug Uses

func MakeSlug(str string) string

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

func Words Uses

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.

type HTML Uses

type HTML string

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

func (HTML) Text Uses

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.

Package stringutil imports 10 packages (graph) and is imported by 14 packages. Updated 2018-05-18. Refresh now. Tools for package owners.