Version: v1.0.9 Latest Latest

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

Go to latest
Published: Apr 20, 2018 License: Apache-2.0 Imports: 4 Imported by: 0




This section is empty.


View Source
var ErrSyntax = errors.New("invalid syntax")

ErrSyntax indicates that a value does not have the right syntax for the target type.


func CompilePattern

func CompilePattern(pattern string, escape byte) (patChars, patTypes []byte)

CompilePattern handles escapes and wild cards convert pattern characters and pattern types.

func DoMatch

func DoMatch(str string, patChars, patTypes []byte) bool

DoMatch matches the string with patChars and patTypes.

func RemoveBlanks

func RemoveBlanks(s string) string

RemoveBlanks removes all blanks, returns a new string.

func Unquote

func Unquote(s string) (t string, err error)

Unquote interprets s as a single-quoted, double-quoted, or backquoted Go string literal, returning the string value that s quotes. For example: test=`"\"\n"` (hex: 22 5c 22 5c 6e 22) should be converted to `"\n` (hex: 22 0a).

func UnquoteChar

func UnquoteChar(s string, quote byte) (value []byte, tail string, err error)

UnquoteChar decodes the first character or byte in the escaped string or character literal represented by the string s. It returns four values:

1) value, the decoded Unicode code point or byte value; 2) multibyte, a boolean indicating whether the decoded character requires a multibyte UTF-8 representation; 3) tail, the remainder of the string after the character; and 4) an error that will be nil if the character is syntactically valid.

The second argument, quote, specifies the type of literal being parsed and therefore which escaped quote character is permitted. If set to a single quote, it permits the sequence \' and disallows unescaped '. If set to a double quote, it permits \" and disallows unescaped ". If set to zero, it does not permit either escape and allows both quote characters to appear unescaped. Different with strconv.UnquoteChar, it permits unnecessary backslash.


This section is empty.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL