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) stringParameters & Attributes
| Name | Type | Description |
|---|---|---|
| state | State | Formatting state received by a custom Formatter. |
| verb | rune | Formatting 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))}