text

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: Unlicense Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommonSentenceStarts = []string{"He", "She", "They", "His", "Her", "Their", "The", "It"}

Functions

func AppendAside

func AppendAside(s, clause string) string

func AppendClause

func AppendClause(s, clause string) string

func AppendIndependentClause

func AppendIndependentClause(s, clause string) string

func AppendRelated

func AppendRelated(s, clause string) string

func AppendSentence

func AppendSentence(base, s string) string

func CardinalNoun

func CardinalNoun(n int) string

func CardinalSuffix

func CardinalSuffix(n int) string

func CardinalWithUnit

func CardinalWithUnit(n int, singular string, plural string) string

func FinishSentence

func FinishSentence(s string) string

func FormatSentence

func FormatSentence(s string) string

func JoinList

func JoinList(strs []string) string

func JoinListOr

func JoinListOr(strs []string) string

func JoinSentenceParts

func JoinSentenceParts(parts ...string) string

func JoinSentences

func JoinSentences(ss ...string) string

func LowerFirst

func LowerFirst(s string) string

func LowerIfFirstWordIn

func LowerIfFirstWordIn(s string, words ...string) string

func MaybeAn

func MaybeAn(s string) string

func MaybePluralise

func MaybePluralise(s string, quantity int) string

func MaybePossessiveSuffix

func MaybePossessiveSuffix(s string) string

func MultiplicativeAdverb

func MultiplicativeAdverb(n int) string

func OrdinalNoun

func OrdinalNoun(n int) string

func PrefixLines

func PrefixLines(s string, prefix string) string

func RemoveAllWhitespace

func RemoveAllWhitespace(s string) string

func RemoveRedundantWhitespace

func RemoveRedundantWhitespace(s string) string

func ReplaceFirstNumberWithCardinalNoun

func ReplaceFirstNumberWithCardinalNoun(s string) string

func SmallCardinalNoun

func SmallCardinalNoun(n int) string

func StartsWithNumeral

func StartsWithNumeral(s string) bool

func StripNewlines

func StripNewlines(s string) string

func StripTerminator

func StripTerminator(s string) string

func StripWasIs

func StripWasIs(st string) string

func UpperFirst

func UpperFirst(s string) string

Types

type Para

type Para struct {
	// contains filtered or unexported fields
}

func (*Para) AddCompleteSentence

func (p *Para) AddCompleteSentence(ss ...string)

AddCompleteSentence combines the supplied strings into a formatted sentence and adds it to the para. Any open sentence is finished first. The para is left at the start of a new sentence.

func (*Para) AppendAsAside

func (p *Para) AppendAsAside(clause string)

AppendAsAside appends an aside to the current sentence, preceding it with a comma if necessary and appending a comma after the clause.

func (*Para) AppendClause

func (p *Para) AppendClause(ss ...string)

AppendClause appends a clause to the current sentence, preceding it with a comma if necessary.

func (*Para) AppendList

func (p *Para) AppendList(ss ...string)

func (*Para) Continue

func (p *Para) Continue(ss ...string)

Continue continues an existing sentence

func (*Para) CurrentSentenceLength

func (p *Para) CurrentSentenceLength() int

func (*Para) CurrentSentenceWords

func (p *Para) CurrentSentenceWords() int

func (*Para) DropSentence

func (p *Para) DropSentence()

DropSentence drops the current sentence

func (*Para) FinishSentence

func (p *Para) FinishSentence()

FinishSentence completes the current sentence, terminating it with a full stop and leaves the paragraph ready for the next one.

func (*Para) FinishSentenceWithTerminator

func (p *Para) FinishSentenceWithTerminator(t string)

FinishSentence completes the current sentence, terminating it with t and leaves the paragraph ready for the next one.

func (*Para) Length

func (p *Para) Length() int

func (*Para) NewSentence

func (p *Para) NewSentence(ss ...string)

NewSentence begins a new sentence by finishing any existing sentence and combining the strings into text which becomes the current sentence. No punctuation or formatting is performed on the new sentence.

func (*Para) ReplaceSentence

func (p *Para) ReplaceSentence(s string)

ReplaceSentence replaces the current sentence with s

func (*Para) Text

func (p *Para) Text() string

Jump to

Keyboard shortcuts

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