Standard library / fmt

fmt.FormatString()

Reconstructs the formatting directive from the State and verb supplied to a Formatter. It does not format an operand itself. Expected stdout: '%08.2f\n'.

Formal Syntax & Structure

go syntaxgo
func FormatString(state State, verb rune) string

Parameters & Attributes

NameTypeDescription
stateStateFormatting state received by a custom Formatter.
verbruneFormatting verb received by the Formatter.

Return Value

string

Formatted text.

Working Example

Example Snippetgo
package main
import (  "fmt")
type probe int
func (p probe) Format(s fmt.State, v rune) { fmt.Fprint(s, fmt.FormatString(s, v)) }func main() {  fmt.Printf("%08.2f\n", probe(0))}
Go Reference