text

package
v0.1.1-beta Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package text provides text manipulation utilities for formatting.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsIdentifierChar

func IsIdentifierChar(c byte) bool

IsIdentifierChar returns true if c can be part of a Go identifier.

func IsIdentifierStart

func IsIdentifierStart(c byte) bool

IsIdentifierStart returns true if c can start a Go identifier.

func IsKeyword

func IsKeyword(s string) bool

IsKeyword returns true if s is a Go keyword.

func LastLineStart

func LastLineStart(b []byte, pos int) int

LastLineStart finds the start position of the line containing pos. Returns 0 if pos is on the first line.

func LeadingWhitespace

func LeadingWhitespace(b []byte, lineStart int) []byte

LeadingWhitespace extracts the whitespace prefix from the line starting at lineStart in b.

func QuoteGoString

func QuoteGoString(s string) string

QuoteGoString returns s as a double-quoted Go string literal. It preserves printable runes and escapes only what's required.

func SplitQuotedString

func SplitQuotedString(text string, startCol int, contIndent string, colLimit,
	tabStop int) string

SplitQuotedString splits text into quoted segments that fit within the given width starting at startCol for the first segment. Continuation lines are indented with contIndent. Segments are joined with " +" at line breaks.

Types

This section is empty.

Jump to

Keyboard shortcuts

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