Skip to content

Latest commit

 

History

History
41 lines (30 loc) · 483 Bytes

README.md

File metadata and controls

41 lines (30 loc) · 483 Bytes

banytostring

将任何输入转化成字符串

API

  • ToStringE
ToStringE(i interface{}) (string, error) 
  • ToString
ToString(v any) string 

EXAMPLE

package main

import (
	"fmt"
	"github.com/songzhibin97/go-baseutils/base/banytostring"
)

func main() {
	v := "test"
	nv, err := anytostring.ToStringE(v)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(nv) // test
	
	v = "test"
	fmt.Println(anytostring.ToString(v)) // test
}