Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func String ¶
String converts whatever is passed to its fmt.Sprintf("%v") string version (but avoids calling it if possible). Be sure you use things with consistent string representations.
Example ¶
package main
import (
"fmt"
"github.com/rwxrob/to"
)
type stringer struct{}
func (s stringer) String() string { return "stringer" }
func main() {
stuff := []any{
"some", []byte{'t', 'h', 'i', 'n', 'g'},
1, 2.234, stringer{},
}
for _, s := range stuff {
fmt.Printf("%q ", to.String(s))
}
}
Output: "some" "thing" "1" "2.234" "stringer"
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.