Documentation
¶
Index ¶
- Constants
- func Join(env *lisp.LEnv, parts []string, sep string) (string, error)
- func LoadPackage(env *lisp.LEnv) *lisp.LVal
- func Repeat(env *lisp.LEnv, str string, n int) (string, error)
- func Split(env *lisp.LEnv, str, sep string) ([]string, error)
- func SplitCount(env *lisp.LEnv, str, sep string) (int, error)
Constants ¶
const DefaultPackageName = "string"
DefaultPackageName is the package name used by LoadPackage.
Variables ¶
This section is empty.
Functions ¶
func Join ¶ added in v1.77.0
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 ¶
LoadPackage adds the string package to env
func Repeat ¶ added in v1.95.0
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
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
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.