text

package
v0.24.8 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2024 License: BSD-3-Clause Imports: 11 Imported by: 1

Documentation

Overview

Text manipulation and transformation.

Index

Constants

This section is empty.

Variables

View Source
var Z_Types = typeinfo.TypeSet{
	Name: "text",
	Comment: []string{
		"Text manipulation and transformation.",
	},

	Flow:       z_flow_list,
	Signatures: z_signatures,
}

package listing of type data

View Source
var Zt_Capitalize typeinfo.Flow

capitalize, a type of flow.

View Source
var Zt_FindText typeinfo.Flow

find_text, a type of flow.

View Source
var Zt_IsNothing typeinfo.Flow

is_nothing, a type of flow.

View Source
var Zt_Join typeinfo.Flow

join, a type of flow.

View Source
var Zt_MakeLowercase typeinfo.Flow

make_lowercase, a type of flow.

View Source
var Zt_MakeReversed typeinfo.Flow

make_reversed, a type of flow.

View Source
var Zt_MakeSentenceCase typeinfo.Flow

make_sentence_case, a type of flow.

View Source
var Zt_MakeTitleCase typeinfo.Flow

make_title_case, a type of flow.

View Source
var Zt_MakeUppercase typeinfo.Flow

make_uppercase, a type of flow.

View Source
var Zt_Matches typeinfo.Flow

matches, a type of flow.

View Source
var Zt_Pluralize typeinfo.Flow

pluralize, a type of flow.

View Source
var Zt_Singularize typeinfo.Flow

singularize, a type of flow.

View Source
var Zt_SplitLines typeinfo.Flow

split_lines, a type of flow.

View Source
var Zt_SplitText typeinfo.Flow

split_text, a type of flow.

View Source
var Zt_SplitWords typeinfo.Flow

split_words, a type of flow.

View Source
var Zt_TextEndsWith typeinfo.Flow

text_ends_with, a type of flow.

View Source
var Zt_TextLen typeinfo.Flow

text_len, a type of flow.

View Source
var Zt_TextStartsWith typeinfo.Flow

text_starts_with, a type of flow.

Functions

func Register added in v0.24.7

func Register(reg func(any))

gob like registration

Types

type Capitalize

type Capitalize struct {
	Text   rtti.TextEval
	Markup map[string]any `json:",omitempty"`
}

Copy some text, changing its first letter to uppercase.

func (*Capitalize) GetMarkup

func (op *Capitalize) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*Capitalize) GetText

func (op *Capitalize) GetText(run rt.Runtime) (ret rt.Value, err error)

func (*Capitalize) TypeInfo

func (*Capitalize) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type Capitalize_Slice

type Capitalize_Slice []Capitalize

Holds a slice of type Capitalize.

func (*Capitalize_Slice) Repeats

func (op *Capitalize_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of Capitalize.

func (*Capitalize_Slice) TypeInfo

func (*Capitalize_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of Capitalize.

type FindText

type FindText struct {
	Text    rtti.TextEval
	Subtext rtti.TextEval
	Markup  map[string]any `json:",omitempty"`
}

Determine whether one piece of text contains a second piece of text.

The rt.NumEval version returns the first index at which the text appears, or zero if not found.

func (*FindText) GetBool

func (op *FindText) GetBool(run rt.Runtime) (ret rt.Value, err error)

func (*FindText) GetMarkup

func (op *FindText) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*FindText) GetNum

func (op *FindText) GetNum(run rt.Runtime) (ret rt.Value, err error)

func (*FindText) TypeInfo

func (*FindText) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type FindText_Slice

type FindText_Slice []FindText

Holds a slice of type FindText.

func (*FindText_Slice) Repeats

func (op *FindText_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of FindText.

func (*FindText_Slice) TypeInfo

func (*FindText_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of FindText.

type IsNothing

type IsNothing struct {
	Text   rtti.TextEval
	Markup map[string]any `json:",omitempty"`
}

Determine whether text is completely without content. Even spaces are considered content. The text "" is considered nothing, The text " " is considered something.

func (*IsNothing) GetBool

func (op *IsNothing) GetBool(run rt.Runtime) (ret rt.Value, err error)

func (*IsNothing) GetMarkup

func (op *IsNothing) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*IsNothing) TypeInfo

func (*IsNothing) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type IsNothing_Slice

type IsNothing_Slice []IsNothing

Holds a slice of type IsNothing.

func (*IsNothing_Slice) Repeats

func (op *IsNothing_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of IsNothing.

func (*IsNothing_Slice) TypeInfo

func (*IsNothing_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of IsNothing.

type Join

type Join struct {
	Sep    rtti.TextEval
	Parts  []rtti.TextEval
	Markup map[string]any `json:",omitempty"`
}

Combine text to produce new text.

func (*Join) GetMarkup

func (op *Join) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*Join) GetText

func (op *Join) GetText(run rt.Runtime) (ret rt.Value, err error)

func (*Join) TypeInfo

func (*Join) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type Join_Slice

type Join_Slice []Join

Holds a slice of type Join.

func (*Join_Slice) Repeats

func (op *Join_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of Join.

func (*Join_Slice) TypeInfo

func (*Join_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of Join.

type MakeLowercase

type MakeLowercase struct {
	Text   rtti.TextEval
	Markup map[string]any `json:",omitempty"`
}

Copy some text, changing every letter into lowercase. For example, turns "QUIET" into "quiet.

func (*MakeLowercase) GetMarkup

func (op *MakeLowercase) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*MakeLowercase) GetText

func (op *MakeLowercase) GetText(run rt.Runtime) (ret rt.Value, err error)

func (*MakeLowercase) TypeInfo

func (*MakeLowercase) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type MakeLowercase_Slice

type MakeLowercase_Slice []MakeLowercase

Holds a slice of type MakeLowercase.

func (*MakeLowercase_Slice) Repeats

func (op *MakeLowercase_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of MakeLowercase.

func (*MakeLowercase_Slice) TypeInfo

func (*MakeLowercase_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of MakeLowercase.

type MakeReversed

type MakeReversed struct {
	Text   rtti.TextEval
	Markup map[string]any `json:",omitempty"`
}

Copy some text with its contents flipped back to front. For example, turns "Tapestry" into 'yrtsepaT'.

func (*MakeReversed) GetMarkup

func (op *MakeReversed) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*MakeReversed) GetText

func (op *MakeReversed) GetText(run rt.Runtime) (ret rt.Value, err error)

func (*MakeReversed) TypeInfo

func (*MakeReversed) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type MakeReversed_Slice

type MakeReversed_Slice []MakeReversed

Holds a slice of type MakeReversed.

func (*MakeReversed_Slice) Repeats

func (op *MakeReversed_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of MakeReversed.

func (*MakeReversed_Slice) TypeInfo

func (*MakeReversed_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of MakeReversed.

type MakeSentenceCase

type MakeSentenceCase struct {
	Text   rtti.TextEval
	Markup map[string]any `json:",omitempty"`
}

Copy text, changing the start of each sentence so that it starts with a capital letter. ( Currently, "sentences" are considered to be a series of characters ending with a full-stop followed by a space. ) For example, "see the doctor run. run doctor. run." into "See the doctor run. Run doctor. Run."

func (*MakeSentenceCase) GetMarkup

func (op *MakeSentenceCase) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*MakeSentenceCase) GetText

func (op *MakeSentenceCase) GetText(run rt.Runtime) (ret rt.Value, err error)

func (*MakeSentenceCase) TypeInfo

func (*MakeSentenceCase) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type MakeSentenceCase_Slice

type MakeSentenceCase_Slice []MakeSentenceCase

Holds a slice of type MakeSentenceCase.

func (*MakeSentenceCase_Slice) Repeats

func (op *MakeSentenceCase_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of MakeSentenceCase.

func (*MakeSentenceCase_Slice) TypeInfo

func (*MakeSentenceCase_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of MakeSentenceCase.

type MakeTitleCase

type MakeTitleCase struct {
	Text   rtti.TextEval
	Markup map[string]any `json:",omitempty"`
}

Copy some text, making every word start with a capital letter. For example, turns "empire apple" into "Empire Apple".

func (*MakeTitleCase) GetMarkup

func (op *MakeTitleCase) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*MakeTitleCase) GetText

func (op *MakeTitleCase) GetText(run rt.Runtime) (ret rt.Value, err error)

func (*MakeTitleCase) TypeInfo

func (*MakeTitleCase) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type MakeTitleCase_Slice

type MakeTitleCase_Slice []MakeTitleCase

Holds a slice of type MakeTitleCase.

func (*MakeTitleCase_Slice) Repeats

func (op *MakeTitleCase_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of MakeTitleCase.

func (*MakeTitleCase_Slice) TypeInfo

func (*MakeTitleCase_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of MakeTitleCase.

type MakeUppercase

type MakeUppercase struct {
	Text   rtti.TextEval
	Markup map[string]any `json:",omitempty"`
}

Copy some text, changing every letter into uppercase. For example, transforms "loud" into "LOUD".

func (*MakeUppercase) GetMarkup

func (op *MakeUppercase) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*MakeUppercase) GetText

func (op *MakeUppercase) GetText(run rt.Runtime) (ret rt.Value, err error)

func (*MakeUppercase) TypeInfo

func (*MakeUppercase) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type MakeUppercase_Slice

type MakeUppercase_Slice []MakeUppercase

Holds a slice of type MakeUppercase.

func (*MakeUppercase_Slice) Repeats

func (op *MakeUppercase_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of MakeUppercase.

func (*MakeUppercase_Slice) TypeInfo

func (*MakeUppercase_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of MakeUppercase.

type MatchCache

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

type Matches

type Matches struct {
	Text  rtti.TextEval
	Match string

	Markup map[string]any `json:",omitempty"`
	// contains filtered or unexported fields
}

Determine whether text matches a regular expression. The expressions used are defined by go. https://pkg.go.dev/regexp/syntax https://github.com/google/re2/wiki/Syntax

func (*Matches) GetBool

func (op *Matches) GetBool(run rt.Runtime) (ret rt.Value, err error)

func (*Matches) GetMarkup

func (op *Matches) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*Matches) TypeInfo

func (*Matches) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type Matches_Slice

type Matches_Slice []Matches

Holds a slice of type Matches.

func (*Matches_Slice) Repeats

func (op *Matches_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of Matches.

func (*Matches_Slice) TypeInfo

func (*Matches_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of Matches.

type Pluralize

type Pluralize struct {
	Text   rtti.TextEval
	Markup map[string]any `json:",omitempty"`
}

Pluralize a word. The singular form of a word can have more than one plural form. For example: "person" can be "people" or "persons". If more than one exists, this chooses arbitrarily.

Note, The transformation uses predefined rules and some explicit mappings. The story command [DefinePlural] can add new mappings.

func (*Pluralize) GetMarkup

func (op *Pluralize) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*Pluralize) GetText

func (op *Pluralize) GetText(run rt.Runtime) (ret rt.Value, err error)

func (*Pluralize) TypeInfo

func (*Pluralize) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type Pluralize_Slice

type Pluralize_Slice []Pluralize

Holds a slice of type Pluralize.

func (*Pluralize_Slice) Repeats

func (op *Pluralize_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of Pluralize.

func (*Pluralize_Slice) TypeInfo

func (*Pluralize_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of Pluralize.

type Singularize

type Singularize struct {
	Text   rtti.TextEval
	Markup map[string]any `json:",omitempty"`
}

Change a plural word into its singular form. A plural word only has one singular form. For example, given the word "people", return "person". See [pluralize] for more information.

func (*Singularize) GetMarkup

func (op *Singularize) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*Singularize) GetText

func (op *Singularize) GetText(run rt.Runtime) (ret rt.Value, err error)

func (*Singularize) TypeInfo

func (*Singularize) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type Singularize_Slice

type Singularize_Slice []Singularize

Holds a slice of type Singularize.

func (*Singularize_Slice) Repeats

func (op *Singularize_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of Singularize.

func (*Singularize_Slice) TypeInfo

func (*Singularize_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of Singularize.

type SplitLines added in v0.24.8

type SplitLines struct {
	Text   rtti.TextEval
	Markup map[string]any `json:",omitempty"`
}

Separate a piece of text into several parts wherever a newline (\n) occurs.

func (*SplitLines) GetMarkup added in v0.24.8

func (op *SplitLines) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*SplitLines) GetTextList added in v0.24.8

func (op *SplitLines) GetTextList(run rt.Runtime) (ret rt.Value, err error)

func (*SplitLines) TypeInfo added in v0.24.8

func (*SplitLines) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type SplitLines_Slice added in v0.24.8

type SplitLines_Slice []SplitLines

Holds a slice of type SplitLines.

func (*SplitLines_Slice) Repeats added in v0.24.8

func (op *SplitLines_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of SplitLines.

func (*SplitLines_Slice) TypeInfo added in v0.24.8

func (*SplitLines_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of SplitLines.

type SplitText added in v0.24.8

type SplitText struct {
	Text      rtti.TextEval
	Separator rtti.TextEval
	Markup    map[string]any `json:",omitempty"`
}

Separate a piece of text into several parts.

func (*SplitText) GetMarkup added in v0.24.8

func (op *SplitText) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*SplitText) GetTextList added in v0.24.8

func (op *SplitText) GetTextList(run rt.Runtime) (ret rt.Value, err error)

func (*SplitText) TypeInfo added in v0.24.8

func (*SplitText) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type SplitText_Slice added in v0.24.8

type SplitText_Slice []SplitText

Holds a slice of type SplitText.

func (*SplitText_Slice) Repeats added in v0.24.8

func (op *SplitText_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of SplitText.

func (*SplitText_Slice) TypeInfo added in v0.24.8

func (*SplitText_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of SplitText.

type SplitWords added in v0.24.8

type SplitWords struct {
	Text   rtti.TextEval
	Markup map[string]any `json:",omitempty"`
}

Separate a piece of text into several parts wherever a space between words occurs.

func (*SplitWords) GetMarkup added in v0.24.8

func (op *SplitWords) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*SplitWords) GetTextList added in v0.24.8

func (op *SplitWords) GetTextList(run rt.Runtime) (ret rt.Value, err error)

func (*SplitWords) TypeInfo added in v0.24.8

func (*SplitWords) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type SplitWords_Slice added in v0.24.8

type SplitWords_Slice []SplitWords

Holds a slice of type SplitWords.

func (*SplitWords_Slice) Repeats added in v0.24.8

func (op *SplitWords_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of SplitWords.

func (*SplitWords_Slice) TypeInfo added in v0.24.8

func (*SplitWords_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of SplitWords.

type TextEndsWith

type TextEndsWith struct {
	Text    rtti.TextEval
	Subtext rtti.TextEval
	Markup  map[string]any `json:",omitempty"`
}

Determine whether text ends in a particular way.

func (*TextEndsWith) GetBool

func (op *TextEndsWith) GetBool(run rt.Runtime) (ret rt.Value, err error)

func (*TextEndsWith) GetMarkup

func (op *TextEndsWith) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*TextEndsWith) TypeInfo

func (*TextEndsWith) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type TextEndsWith_Slice

type TextEndsWith_Slice []TextEndsWith

Holds a slice of type TextEndsWith.

func (*TextEndsWith_Slice) Repeats

func (op *TextEndsWith_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of TextEndsWith.

func (*TextEndsWith_Slice) TypeInfo

func (*TextEndsWith_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of TextEndsWith.

type TextLen

type TextLen struct {
	Text   rtti.TextEval
	Markup map[string]any `json:",omitempty"`
}

Count the number of characters in some text.

func (*TextLen) GetMarkup

func (op *TextLen) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*TextLen) GetNum

func (op *TextLen) GetNum(run rt.Runtime) (ret rt.Value, err error)

func (*TextLen) TypeInfo

func (*TextLen) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type TextLen_Slice

type TextLen_Slice []TextLen

Holds a slice of type TextLen.

func (*TextLen_Slice) Repeats

func (op *TextLen_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of TextLen.

func (*TextLen_Slice) TypeInfo

func (*TextLen_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of TextLen.

type TextStartsWith

type TextStartsWith struct {
	Text    rtti.TextEval
	Subtext rtti.TextEval
	Markup  map[string]any `json:",omitempty"`
}

Determine whether text starts in a particular way.

func (*TextStartsWith) GetBool

func (op *TextStartsWith) GetBool(run rt.Runtime) (ret rt.Value, err error)

func (*TextStartsWith) GetMarkup

func (op *TextStartsWith) GetMarkup(ensure bool) map[string]any

Implements typeinfo.Markup

func (*TextStartsWith) TypeInfo

func (*TextStartsWith) TypeInfo() typeinfo.T

Implements typeinfo.Instance

type TextStartsWith_Slice

type TextStartsWith_Slice []TextStartsWith

Holds a slice of type TextStartsWith.

func (*TextStartsWith_Slice) Repeats

func (op *TextStartsWith_Slice) Repeats() bool

Implements typeinfo.Repeats for a slice of TextStartsWith.

func (*TextStartsWith_Slice) TypeInfo

func (*TextStartsWith_Slice) TypeInfo() typeinfo.T

Implements typeinfo.Instance for a slice of TextStartsWith.

Jump to

Keyboard shortcuts

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