text

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = module.NewBuiltin().
	Func("re_match(pattern string, text string) (matched bool, err error)												returns whether the text matches the regular expression pattern", textREMatch).
	Func("re_find(pattern string, text string, count int) (matches [[{text string, begin int, end int}]], err error)	returns the matches of the regular expression pattern in the text. If count is not provided, it returns the first match.", textREFind).
	Func("re_replace(pattern string, text string, repl string) (result string, err error)								returns a copy of the text with all matches of the regular expression pattern replaced by the replacement string repl", textREReplace).
	Func("re_split(pattern string, text string, count int) (result [string], err error)									returns a slice of strings split by the regular expression pattern. If count is not provided, it splits all occurrences.", textRESplit).
	Func("re_compile(pattern string) (re Regexp, err error)																compiles the regular expression pattern and returns a Regexp object", textRECompile).
	Func("compare(a string, b string) (ret int)																			returns an integer comparing two strings lexicographically", strings.Compare).
	Func("contains(s string, substr string) (ret bool)																	returns true if substr is within s", strings.Contains).
	Func("contains_any(s string, chars string) (ret bool)																returns true if any Unicode code point in chars is within s", strings.ContainsAny).
	Func("count(s string, substr string) (ret int)																		returns the number of non-overlapping instances of substr in s", strings.Count).
	Func("equal_fold(s string, t string) (ret bool)																		returns true if s and t are equal under Unicode case-folding", strings.EqualFold).
	Func("fields(s string) (ret string)																					returns a slice of strings split from s by white space", strings.Fields).
	Func("has_prefix(s string, prefix string) (ret bool)																returns true if s begins with prefix", strings.HasPrefix).
	Func("has_suffix(s string, suffix string) (ret bool)																returns true if s ends with suffix", strings.HasSuffix).
	Func("index(s string, substr string) (ret int)																		returns the index of the first instance of substr in s, or -1 if substr is not present in s", strings.Index).
	Func("index_any(s string, chars string) (ret int)																	returns the index of the first instance of any Unicode code point in chars in s, or -1 if no Unicode code point in chars is present in s", strings.IndexAny).
	Func("join(arr [string], sep string) (ret string)																	returns the concatenation of the elements of arr separated by the separator sep", textJoin).
	Func("last_index(s string, substr string) (ret int)																	returns the index of the last instance of substr in s, or -1 if substr is not present in s", strings.LastIndex).
	Func("last_index_any(s string, chars string) (ret int)																returns the index of the last instance of any Unicode code point in chars in s, or -1 if no Unicode code point in chars is present in s", strings.LastIndexAny).
	Func("repeat(s string, count int) (ret string)																		returns a new string consisting of count copies of the string s", textRepeat).
	Func("replace(s string, old string, new string, n int) (ret string)													returns a copy of the string s with the first n non-overlapping instances of old replaced by new. If old is empty, it matches at the beginning of the string and after each UTF-8 sequence, yielding up to k+1 replacements for a k-rune string. If n < 0, there is no limit on the number of replacements.", textReplace).
	Func("substr(s string, lower int, upper int) (ret string)															returns the substring of s from index lower to upper. If upper is not provided, it returns the substring from lower to the end of s", textSubstring).
	Func("split(s string, sep string) (ret string)																		returns a slice of strings split from s by the separator sep", strings.Split).
	Func("split_after(s string, sep string) (ret string)																returns a slice of strings split from s by the separator sep, including the separator in the resulting strings", strings.SplitAfter).
	Func("split_after_n(s string, sep string, n int) (ret string)														returns a slice of strings split from s by the separator sep, including the separator in the resulting strings, with a maximum of n splits", strings.SplitAfterN).
	Func("split_n(s string, sep string, n int) (ret string)																returns a slice of strings split from s by the separator sep, with a maximum of n splits", strings.SplitN).
	Func("title(s string) (ret string)																					returns a copy of the string s with all Unicode letters that begin words mapped to their title case", textTitle).
	Func("to_lower(s string) (ret string)																				returns a copy of the string s with all Unicode letters mapped to their lower case", strings.ToLower).
	Func("to_title(s string) (ret string)																				returns a copy of the string s with all Unicode letters mapped to their title case", strings.ToTitle).
	Func("to_upper(s string) (ret string)																				returns a copy of the string s with all Unicode letters mapped to their upper case", strings.ToUpper).
	Func("pad_left(s string, pad_len int, pad_with string) (ret string)													returns a copy of the string s left-padded with the pad_with string to a total length of pad_len. If pad_with is not provided, it defaults to a single space", textPadLeft).
	Func("pad_right(s string, pad_len int, pad_with string) (ret string)												returns a copy of the string s right-padded with the pad_with string to a total length of pad_len. If pad_with is not provided, it defaults to a single space", textPadRight).
	Func("trim(s string, cutset string) (ret string)																	returns a copy of the string s with all leading and trailing Unicode code points contained in cutset removed", strings.Trim).
	Func("trim_left(s string, cutset string) (ret string)																returns a copy of the string s with all leading Unicode code points contained in cutset removed", strings.TrimLeft).
	Func("trim_prefix(s string, prefix string) (ret string)																returns s without the provided leading prefix string. If s doesn't start with prefix, s is returned unchanged", strings.TrimPrefix).
	Func("trim_right(s string, cutset string) (ret string)																returns a copy of the string s with all trailing Unicode code points contained in cutset removed", strings.TrimRight).
	Func("trim_space(s string) (ret string)																				returns a copy of the string s with all leading and trailing white space removed, as defined by Unicode", strings.TrimSpace).
	Func("trim_suffix(s string, suffix string) (ret string)																returns s without the provided trailing suffix string. If s doesn't end with suffix, s is returned unchanged", strings.TrimSuffix).
	Func("atoi(str string) (i int, err error)																			returns the integer represented by the string str", strconv.Atoi).
	Func("format_bool(b bool) (ret string)																				returns the string representation of the boolean value b", textFormatBool).
	Func("format_float(f float, fmt byte, prec int, bits int) (ret string)												returns the string representation of the floating-point number f formatted according to the format fmt and precision prec", textFormatFloat).
	Func("format_int(i int, base int) (ret string)																		returns the string representation of the integer i in the specified base", textFormatInt).
	Func("itoa(i int) (ret string)																						returns the string representation of the integer i", strconv.Itoa).
	Func("parse_bool(str string) (b bool, err error)																	returns the boolean value represented by the string str", textParseBool).
	Func("parse_float(str string, bits int) (f float, err error)														returns the floating-point number represented by the string str", textParseFloat).
	Func("parse_int(str string, base int, bits int) (i int, err error)													returns the integer represented by the string str in the specified base and bit size", textParseInt).
	Func("quote(str string) (ret string)																				returns a double-quoted Go string literal representing str", strconv.Quote).
	Func("unquote(str string) (result string, err error)																returns the string represented by the Go string literal str", strconv.Unquote)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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