func Append
Append formats using default formats, appends to b, and returns the updated slice. Spaces are added between arguments.
v0 - Unaudited: This is an initial version that has not yet been formally audited. A fully audited version will be pu...
v0 - Unaudited This is an initial version of this package that has not yet been formally audited. A fully audited version will be published as a subsequent release. Use in production at your own risk.
Package ufmt provides utility functions for formatting strings, similarly to the Go package fmt, of which only a subset is currently supported.
v0 - Unaudited: This is an initial version that has not yet been formally audited. A fully audited version will be published as a subsequent release. Use in production at your own risk.
Package ufmt provides utility functions for formatting strings, similarly to the Go package "fmt", of which only a subset is currently supported.
Package ufmt provides utility functions for formatting strings, similarly to the Go package "fmt", of which only a subset is currently supported (hence the name µfmt - micro fmt). It includes functions like Printf, Sprintf, Fprintf, and Errorf. Supported formatting verbs are documented in the Sprintf function.
Append formats using default formats, appends to b, and returns the updated slice. Spaces are added between arguments.
Appendf formats according to a format specifier, appends the result to the byte slice, and returns the updated slice.
Appendln formats using default formats, appends to b, and returns the updated slice. Appends a newline after the last argument.
Errorf formats according to a format specifier and returns an error value. Supports the same verbs as Sprintf. See Sprintf documentation for details.
Fprint formats using default formats and writes to w. Spaces are added between arguments. Returns the number of bytes written and any write error encountered.
Fprintf formats according to a format specifier and writes to w. Returns the number of bytes written and any write error encountered.
Fprintln formats using default formats and writes to w with newline. Returns the number of bytes written and any write error encountered.
Print formats using default formats and writes to standard output. Spaces are added between arguments. Returns the number of bytes written and any write error encountered.
XXX: Replace with os.Stdout handling when available.
Printf formats according to a format specifier and writes to standard output. Returns the number of bytes written and any write error encountered.
XXX: Replace with os.Stdout handling when available.
Println formats using default formats and writes to standard output with newline. Returns the number of bytes written and any write error encountered.
XXX: Replace with os.Stdout handling when available.
Sprint formats using the default formats for its operands and returns the resulting string. Sprint writes the given arguments with spaces between arguments.
Sprintf offers similar functionality to Go's fmt.Sprintf, or the sprintf equivalent available in many languages, including C/C++. The number of args passed must exactly match the arguments consumed by the format. A limited number of formatting verbs and features are currently supported.
Supported verbs:
1%s: Places a string value directly.
2 If the value implements the interface interface{ String() string },
3 the String() method is called to retrieve the value. Same about Error()
4 string.
5%c: Formats the character represented by Unicode code point
6%d: Formats an integer value using package "strconv".
7 Currently supports only uint, uint64, int, int64.
8%f: Formats a float value, with a default precision of 6.
9%e: Formats a float with scientific notation; 1.23456e+78
10%E: Formats a float with scientific notation; 1.23456E+78
11%F: The same as %f
12%g: Formats a float value with %e for large exponents, and %f with full precision for smaller numbers
13%G: Formats a float value with %G for large exponents, and %F with full precision for smaller numbers
14%t: Formats a boolean value to "true" or "false".
15%x: Formats an integer value as a hexadecimal string.
16 Currently supports only uint8, []uint8, [32]uint8.
17%c: Formats a rune value as a string.
18 Currently supports only rune, int.
19%q: Formats a string value as a quoted string.
20%T: Formats the type of the value.
21%v: Formats the value with a default representation appropriate for the value's type
22 - nil: <nil>
23 - bool: true/false
24 - integers: base 10
25 - float64: %g format
26 - string: verbatim
27 - types with String()/Error(): method result
28 - others: (unhandled)
29%%: Outputs a literal %. Does not consume an argument.
Unsupported verbs or type mismatches produce error strings like "%!d(string=foo)".
Sprintln formats using default formats and returns the string with newline. Spaces are always added between arguments.