Help us shape the future of Go! Take the 2026 Go Developer Survey

libstring

package
v1.95.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: BSD-3-Clause Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const DefaultPackageName = "string"

DefaultPackageName is the package name used by LoadPackage.

Variables

This section is empty.

Functions

func Join added in v1.77.0

func Join(env *lisp.LEnv, parts []string, sep string) (string, error)

Join returns the string string:join returns for a list of the strings parts and the separator sep, or the same error from the same check. It checks the evaluation's context first, as LEnv.CallBuiltin does. Then it makes string:join's allocation check ("join would exceed maximum allocation size (N bytes)") and charges its steps: one per complete KiB of the result. The caller has no element type to check: every part is a string. The error is string:join's own *lisp.ErrorVal, so a FuncE body that returns it raises the same condition.

func LoadPackage

func LoadPackage(env *lisp.LEnv) *lisp.LVal

LoadPackage adds the string package to env

func Repeat added in v1.95.0

func Repeat(env *lisp.LEnv, str string, n int) (string, error)

Repeat returns the string string:repeat returns for the string str and the count n, or the same error from the same check. It checks the evaluation's context first, as LEnv.CallBuiltin does. Then it makes string:repeat's checks ("count is negative: N", then "repeat would exceed maximum allocation size (N bytes)") and charges its steps: one per complete KiB of the result. The caller has no argument type to check. The error is string:repeat's own *lisp.ErrorVal, so a FuncE body that returns it raises the same condition.

func Split added in v1.95.0

func Split(env *lisp.LEnv, str, sep string) ([]string, error)

Split returns the pieces string:split returns for the strings str and sep, or the same error from the same check. It checks the evaluation's context first, as LEnv.CallBuiltin does. Then it charges string:split's steps (one per complete KiB of str) and makes its allocation check ("split would exceed maximum allocation size (N elements)"). A Go port of Lisp code that called string:split calls it, so the port fails where the Lisp failed and charges the steps it charged. The error is string:split's own *lisp.ErrorVal, so a FuncE body that returns it raises the same condition.

func SplitCount added in v1.95.0

func SplitCount(env *lisp.LEnv, str, sep string) (int, error)

SplitCount returns the number of pieces Split returns, after the same checks, with the same errors and steps, but builds no pieces. A Go port of Lisp code that only counted the pieces of string:split calls it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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