Documentation
¶
Overview ¶
Package splitter implements a string splitting package. It defines a type, Splitter, with Buffer to store and change data, and Rule functions that control its behavior.
Package splitter implements a string splitting package. It defines a type, Splitter, with Buffer to store and change data, and Rule functions that control its behavior.
Package splitter implements a string splitting package. It defines a type, Splitter, with Buffer to store and change data, and Rule functions that control its behavior.
Package splitter implements a string splitting package. It defines a type, Splitter, with Buffer to store and change data, and Rule functions that control its behavior.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer represents a temporary storage for Splitter.
func (*Buffer) GetIncoming ¶
GetIncoming returns incoming slice.
type CharRule ¶ added in v1.1.0
CharRule function should return true if given character satisfies the rule and false otherwise.
func AnyChar ¶ added in v1.2.0
func AnyChar() CharRule
AnyChar returns a CharRule that returns true in any case.
func CharInSet ¶ added in v1.2.0
func CharInSet[T comparable](set map[rune]T) CharRule
CharInSet returns a CharRule that checks if character is represented in the set.
type Option ¶
type Option func(*Splitter)
Option function is applied in constructor function of the Splitter.
func AddJoin ¶
AddJoin returns an Option that adds Rule functions to the join section of the Splitter.
type Rule ¶
Rule function gains access to Buffer data using its public methods.
Should return true if current Buffer state satisfies the rule and false otherwise.
func After ¶ added in v1.1.0
After returns a Rule that checks if the last character in Buffer satisfies the CharRule.
func Before ¶ added in v1.1.0
Before returns a Rule that checks if the next character incoming in Buffer satisfies the CharRule.
func Everything ¶ added in v1.2.0
func Everything() Rule
Everything returns a Rule that returns true in any case.
func WordInSet ¶ added in v1.2.0
func WordInSet[T comparable](set map[string]T) Rule
CharInSet returns a Rule that checks if current word in Buffer is represented in the set.