strings

package
v7.25.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package "strings" provides a framework of aspects and class definitions for a rich set of primitive data types that can be iterated over. All primitive types are immutable and—for better performance—are implemented as extensions to existing Go primitive types.

For detailed documentation on this package refer to the wiki:

This package follows the Crater Dog Technologies™ Go Coding Conventions located here:

Additional concrete implementations of the classes declared by this package can be developed and used seamlessly since the interface declarations only depend on other interfaces and intrinsic types—and the class implementations only depend on interfaces, not on each other.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Accessible

type Accessible[V any] interface {
	GetValue(
		index int,
	) V
	GetValues(
		first int,
		last int,
	) Sequential[V]
	GetIndex(
		value V,
	) int
}

Accessible[V any] is an aspect interface that declares a set of method signatures that must be supported by each instance of an accessible concrete class.

An accessible class maintains values that can be accessed using indices. The indices of an accessible sequence are ORDINAL rather than ZERO based—which never really made sense except for pointer offsets. What is the "zeroth value" anyway? It's the "first value", right? So we start fresh...

This approach allows for positive indices starting at the beginning of the sequence, and negative indices starting at the end of the sequence as follows:

    1           2           3             N
[value 1] . [value 2] . [value 3] ... [value N]
   -N        -(N-1)      -(N-2)          -1

Notice that because the indices are ordinal based, the positive and negative indices are symmetrical.

type BinaryClassLike

type BinaryClassLike interface {
	// Constructor Methods
	Binary(
		bytes []byte,
	) BinaryLike
	BinaryFromSequence(
		sequence Sequential[byte],
	) BinaryLike
	BinaryFromString(
		source string,
	) BinaryLike

	// Function Methods
	Not(
		binary BinaryLike,
	) BinaryLike
	And(
		first BinaryLike,
		second BinaryLike,
	) BinaryLike
	San(
		first BinaryLike,
		second BinaryLike,
	) BinaryLike
	Ior(
		first BinaryLike,
		second BinaryLike,
	) BinaryLike
	Xor(
		first BinaryLike,
		second BinaryLike,
	) BinaryLike
	Concatenate(
		first BinaryLike,
		second BinaryLike,
	) BinaryLike
}

BinaryClassLike is a class interface that defines the complete set of class constants, constructors and functions that must be supported by each binary-like concrete class.

func BinaryClass

func BinaryClass() BinaryClassLike

type BinaryLike

type BinaryLike interface {
	// Principal Methods
	GetClass() BinaryClassLike
	AsIntrinsic() []byte
	AsString() string

	// Aspect Interfaces
	Accessible[byte]
	Searchable[byte]
	Sequential[byte]
}

BinaryLike is an instance interface that declares the complete set of principal, attribute and aspect methods that must be supported by each instance of a concrete binary-like class.

type Character

type Character rune

Character is a constrained type representing a single character of a quote.

func (Character) String

func (v Character) String() string

type Identifier

type Identifier string

Identifier is a constrained type representing a string of the form: (LOWER | UPPER) (LOWER | UPPER | DIGIT | '-')

type Line

type Line string

Line is a constrained type representing a single line of a narrative.

type NameClassLike

type NameClassLike interface {
	// Constructor Methods
	Name(
		identifiers []Identifier,
	) NameLike
	NameFromSequence(
		sequence Sequential[Identifier],
	) NameLike
	NameFromString(
		source string,
	) NameLike

	// Function Methods
	Concatenate(
		first NameLike,
		second NameLike,
	) NameLike
}

NameClassLike is a class interface that defines the complete set of class constants, constructors and functions that must be supported by each name-like concrete class.

func NameClass

func NameClass() NameClassLike

type NameLike

type NameLike interface {
	// Principal Methods
	GetClass() NameClassLike
	AsIntrinsic() []Identifier
	AsString() string

	// Aspect Interfaces
	Accessible[Identifier]
	Searchable[Identifier]
	Sequential[Identifier]
	Spectral[NameLike]
}

NameLike is an instance interface that declares the complete set of principal, attribute and aspect methods that must be supported by each instance of a concrete name-like class.

type NarrativeClassLike

type NarrativeClassLike interface {
	// Constructor Methods
	Narrative(
		lines []Line,
	) NarrativeLike
	NarrativeFromSequence(
		sequence Sequential[Line],
	) NarrativeLike
	NarrativeFromString(
		source string,
	) NarrativeLike

	// Function Methods
	Concatenate(
		first NarrativeLike,
		second NarrativeLike,
	) NarrativeLike
}

NarrativeClassLike is a class interface that defines the complete set of class constants, constructors and functions that must be supported by each narrative-like concrete class.

func NarrativeClass

func NarrativeClass() NarrativeClassLike

type NarrativeLike

type NarrativeLike interface {
	// Principal Methods
	GetClass() NarrativeClassLike
	AsIntrinsic() []Line
	AsString() string

	// Aspect Interfaces
	Accessible[Line]
	Searchable[Line]
	Sequential[Line]
}

NarrativeLike is an instance interface that declares the complete set of principal, attribute and aspect methods that must be supported by each instance of a concrete narrative-like class.

type PatternClassLike

type PatternClassLike interface {
	// Constructor Methods
	Pattern(
		characters []Character,
	) PatternLike
	PatternFromSequence(
		sequence Sequential[Character],
	) PatternLike
	PatternFromString(
		source string,
	) PatternLike

	// Constant Methods
	None() PatternLike
	Any() PatternLike

	// Function Methods
	Concatenate(
		first PatternLike,
		second PatternLike,
	) PatternLike
}

PatternClassLike is a class interface that defines the complete set of class constants, constructors and functions that must be supported by each pattern-like concrete class.

func PatternClass

func PatternClass() PatternClassLike

type PatternLike

type PatternLike interface {
	// Principal Methods
	GetClass() PatternClassLike
	AsIntrinsic() []Character
	AsString() string
	AsRegexp() *reg.Regexp
	MatchesText(
		text string,
	) bool
	GetMatches(
		text string,
	) []string

	// Aspect Interfaces
	Accessible[Character]
	Searchable[Character]
	Sequential[Character]
}

PatternLike is an instance interface that defines the complete set of instance attributes, abstractions and methods that must be supported by each instance of a pattern-like elemental class.

type QuoteClassLike

type QuoteClassLike interface {
	// Constructor Methods
	Quote(
		characters []Character,
	) QuoteLike
	QuoteFromSequence(
		sequence Sequential[Character],
	) QuoteLike
	QuoteFromString(
		source string,
	) QuoteLike

	// Function Methods
	Concatenate(
		first QuoteLike,
		second QuoteLike,
	) QuoteLike
}

QuoteClassLike is a class interface that defines the complete set of class constants, constructors and functions that must be supported by each quote-like concrete class.

func QuoteClass

func QuoteClass() QuoteClassLike

type QuoteLike

type QuoteLike interface {
	// Principal Methods
	GetClass() QuoteClassLike
	AsIntrinsic() []Character
	AsString() string

	// Aspect Interfaces
	Accessible[Character]
	Searchable[Character]
	Sequential[Character]
	Spectral[QuoteLike]
}

QuoteLike is an instance interface that declares the complete set of principal, attribute and aspect methods that must be supported by each instance of a concrete quote-like class.

type Searchable

type Searchable[V any] interface {
	ContainsValue(
		value V,
	) bool
	ContainsAny(
		values Sequential[V],
	) bool
	ContainsAll(
		values Sequential[V],
	) bool
}

Searchable[V any] is an aspect interface that declares a set of method signatures that must be supported by each instance of a searchable concrete class.

type Sequential

type Sequential[V any] interface {
	IsEmpty() bool
	GetSize() uint
	AsArray() []V
	GetIterator() age.IteratorLike[V]
}

Sequential[V any] is an aspect interface that declares a set of method signatures that must be supported by each instance of a sequential concrete class.

type Spectral added in v7.15.0

type Spectral[V any] interface {
	AsString() string
	CompareWith(
		value V,
	) age.Rank
}

Spectral[V any] is an aspect interface that declares a set of method signatures that must be supported by each instance of a spectral concrete class.

type TagClassLike

type TagClassLike interface {
	// Constructor Methods
	Tag(
		bytes []byte,
	) TagLike
	TagWithSize(
		size uint,
	) TagLike
	TagFromSequence(
		sequence Sequential[byte],
	) TagLike
	TagFromString(
		source string,
	) TagLike

	// Function Methods
	Concatenate(
		first TagLike,
		second TagLike,
	) TagLike
}

TagClassLike is a class interface that defines the complete set of class constants, constructors and functions that must be supported by each tag-like concrete class.

func TagClass

func TagClass() TagClassLike

type TagLike

type TagLike interface {
	// Principal Methods
	GetClass() TagClassLike
	AsIntrinsic() []byte
	AsString() string
	GetHash() uint64

	// Aspect Interfaces
	Accessible[byte]
	Searchable[byte]
	Sequential[byte]
}

TagLike is an instance interface that declares the complete set of principal, attribute and aspect methods that must be supported by each instance of a concrete tag-like class.

type VersionClassLike

type VersionClassLike interface {
	// Constructor Methods
	Version(
		ordinals []uint,
	) VersionLike
	VersionFromSequence(
		sequence Sequential[uint],
	) VersionLike
	VersionFromString(
		source string,
	) VersionLike

	// Function Methods
	IsValidNextVersion(
		current VersionLike,
		next VersionLike,
	) bool
	GetNextVersion(
		current VersionLike,
		level uint,
	) VersionLike
	Concatenate(
		first VersionLike,
		second VersionLike,
	) VersionLike
}

VersionClassLike is a class interface that defines the complete set of class constants, constructors and functions that must be supported by each version-like concrete class.

func VersionClass

func VersionClass() VersionClassLike

type VersionLike

type VersionLike interface {
	// Principal Methods
	GetClass() VersionClassLike
	AsIntrinsic() []uint
	AsString() string

	// Aspect Interfaces
	Accessible[uint]
	Searchable[uint]
	Sequential[uint]
	Spectral[VersionLike]
}

VersionLike is an instance interface that declares the complete set of principal, attribute and aspect methods that must be supported by each instance of a concrete version-like class.

Jump to

Keyboard shortcuts

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