splitter

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CharacterClass

func CharacterClass(line, separator string) []string

CharacterClass splits on any character from the separator string. Similar to splitting on a regex character class [chars].

func Exact

func Exact(line, separator string) []string

Exact always splits on the exact separator string. Unlike Whitespace, it treats " " as a literal space, not as "any whitespace".

func Whitespace

func Whitespace(line, separator string) []string

Whitespace splits on whitespace (spaces, tabs, etc.) when separator is " ". For any other separator, it splits on that exact string. This mimics awk's default field splitting behavior.

Types

type FieldFunc

type FieldFunc func(line, separator string) []string

FieldFunc splits a line into fields based on a separator. This abstraction enables custom field splitting logic and testing.

func Fixed

func Fixed(positions ...int) FieldFunc

Fixed creates a FieldFunc that splits at fixed-width positions. Positions define where each field starts (0-based). The last position extends to the end of the line.

func Pattern

func Pattern(splitFunc func(string) []string) FieldFunc

Pattern creates a FieldFunc that uses a custom splitting function. This allows for regex-based or other complex splitting logic.

Jump to

Keyboard shortcuts

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