Documentation ¶
Overview ¶
Package strings contains functions for dealing with strings.
Index ¶
- Variables
- func Contains(frame wdte.Frame, args ...wdte.Func) wdte.Func
- func Format(frame wdte.Frame, args ...wdte.Func) wdte.Func
- func Index(frame wdte.Frame, args ...wdte.Func) wdte.Func
- func Lower(frame wdte.Frame, args ...wdte.Func) wdte.Func
- func Prefix(frame wdte.Frame, args ...wdte.Func) wdte.Func
- func Suffix(frame wdte.Frame, args ...wdte.Func) wdte.Func
- func Upper(frame wdte.Frame, args ...wdte.Func) wdte.Func
Constants ¶
This section is empty.
Variables ¶
var Scope = wdte.S().Map(map[wdte.ID]wdte.Func{ "contains": wdte.GoFunc(Contains), "prefix": wdte.GoFunc(Prefix), "suffix": wdte.GoFunc(Suffix), "index": wdte.GoFunc(Index), "upper": wdte.GoFunc(Upper), "lower": wdte.GoFunc(Lower), "format": wdte.GoFunc(Format), })
Scope is a scope containing the functions in this package.
Functions ¶
func Contains ¶
Contains is a WDTE function with the following signatures:
contains outer inner (contains inner) outer
Returns true if inner is a substring of outer.
func Format ¶
Format is a WDTE function with the following signatures:
format tmpl ... (format tmpl) ...
This is the general-purpose string formatting function of the standard library, similar to Go's fmt.Sprintf(). Unlike fmt.Sprintf(), however, format uses a custom formatting specification. A format in the string tmpl is of the form {} with optional flags placed between them. Flags may be any combination of the following:
#<num> The zero-based index of the argument to be inserted. Subsequent formats will increment from here. In other words, '{2} {}' will yield the third and fourth arguments. q Place the value in quotes using strconv.Quote. ? Mark the value with it's underlying Go type, such as wdte.Number(3).
TODO: Add more flags.
func Index ¶
Index is a WDTE function with the following signatures:
index outer inner (index inner) outer
It returns the index of the first character of the first instances of inner in outer. If inner is not a substring of outer, it returns -1.
func Lower ¶
Lower is a WDTE function with the following signature:
lower s
It returns s converted to lowercase.
func Prefix ¶
Prefix is a WDTE function with the following signatures:
prefix s p (prefix p) s
Returns true if p is a prefix of s.
Types ¶
This section is empty.