strings

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package strings contains functions for dealing with strings.

Index

Constants

This section is empty.

Variables

View Source
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

func Contains(frame wdte.Frame, args ...wdte.Func) wdte.Func

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

func Format(frame wdte.Frame, args ...wdte.Func) wdte.Func

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

func Index(frame wdte.Frame, args ...wdte.Func) wdte.Func

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

func Lower(frame wdte.Frame, args ...wdte.Func) wdte.Func

Lower is a WDTE function with the following signature:

lower s

It returns s converted to lowercase.

func Prefix

func Prefix(frame wdte.Frame, args ...wdte.Func) wdte.Func

Prefix is a WDTE function with the following signatures:

prefix s p
(prefix p) s

Returns true if p is a prefix of s.

func Suffix

func Suffix(frame wdte.Frame, args ...wdte.Func) wdte.Func

Suffix is a WDTE function with the following signatures:

suffix s p
(suffix p) s

Returns true if p is a suffix of s.

func Upper

func Upper(frame wdte.Frame, args ...wdte.Func) wdte.Func

Upper is a WDTE function with the following signatures:

upper s

It returns s converted to uppercase.

Types

This section is empty.

Jump to

Keyboard shortcuts

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