to

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2022 License: Apache-2.0 Imports: 1 Imported by: 25

README

Convert "to" Stuff in Go (1.18)

Go Version GoDoc License Go Report Card

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func String

func String(in any) 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL