Documentation ¶
Overview ¶
Package printf implements a parser for fmt.Printf-style format strings.
It parses verbs according to the following syntax:
Numeric -> '0'-'9' Letter -> 'a'-'z' | 'A'-'Z' Index -> '[' Numeric+ ']' Star -> '*' Star -> Index '*' Precision -> Numeric+ | Star Width -> Numeric+ | Star WidthAndPrecision -> Width '.' Precision WidthAndPrecision -> Width '.' WidthAndPrecision -> Width WidthAndPrecision -> '.' Precision WidthAndPrecision -> '.' Flag -> '+' | '-' | '#' | ' ' | '0' Verb -> Letter | '%' Input -> '%' [ Flag+ ] [ WidthAndPrecision ] [ Index ] Verb
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalid = errors.New("invalid format string")
ErrInvalid is returned for invalid format strings or verbs.
Functions ¶
Types ¶
type Argument ¶
type Argument interface {
// contains filtered or unexported methods
}
Argument is an implicit or explicit width or precision.
type Star ¶
type Star struct{ Index int }
Star is a * value, which may either refer to the next argument (Index == -1) or an explicit argument.
type Verb ¶
type Verb struct { Letter rune Flags string Width Argument Precision Argument // Which value in the argument list the verb uses. // -1 denotes the next argument, // values > 0 denote explicit arguments. // The value 0 denotes that no argument is consumed. This is the case for %%. Value int Raw string }
Click to show internal directories.
Click to hide internal directories.