Documentation ¶
Index ¶
- func BoolToString(v *bool) string
- func Float32ToString(v *float32) string
- func Float64ToFloat32(v *float64) float32
- func Float64ToString(v *float64) string
- func Int16ToString(v *int16) string
- func Int32ToString(v *int32) string
- func Int64ToString(v *int64) string
- func Int8ToString(v *int8) string
- func IntToString(v *int) string
- func String[R uconst.BasicType](str string) (R, error)
- func StringOrDef[R uconst.BasicType](str string, def R) (R, error)
- func StringToBool(v *string) (bool, error)
- func StringToFloat32(v *string) (float32, error)
- func StringToFloat64(v *string) (float64, error)
- func StringToInt(v *string) (int, error)
- func StringToInt16(v *string) (int16, error)
- func StringToInt32(v *string) (int32, error)
- func StringToInt64(v *string) (int64, error)
- func StringToInt8(v *string) (int8, error)
- func StringToUint(v *string) (uint, error)
- func StringToUint16(v *string) (uint16, error)
- func StringToUint32(v *string) (uint32, error)
- func StringToUint64(v *string) (uint64, error)
- func StringToUint8(v *string) (uint8, error)
- func Type[V uconst.BasicType](v V) string
- func Uint16ToString(v *uint16) string
- func Uint32ToString(v *uint32) string
- func Uint64ToString(v *uint64) string
- func Uint8ToString(v *uint8) string
- func UintToString(v *uint) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Float32ToString ¶
Float32ToString converts a float32 to string
func Float64ToFloat32 ¶
Float64ToFloat32 converts a float64 to float32
func Float64ToString ¶
Float64ToString converts a float64 to string
func String ¶
String converts the input string to a value of type R. It returns the converted value and an error if the conversion fails.
The type R must satisfy the uconst.BasicType constraint.
Example usage:
value, err := ucast.String[int]("123") if err != nil { // handle error }
func StringOrDef ¶
StringOrDef attempts to convert the input string to a value of type R. If the conversion fails, it returns the default value def and an error.
The type R must satisfy the uconst.BasicType constraint.
Example usage:
value, err := ucast.StringOrDef[int]("invalid", 42) // value == 42, err != nil
func StringToBool ¶
StringToBool converts a string to bool
func StringToFloat32 ¶
StringToFloat32 converts a string to float32
func StringToFloat64 ¶
StringToFloat64 converts a string to float64
func StringToInt16 ¶
StringToInt16 converts a string to int16
func StringToInt32 ¶
StringToInt32 converts a string to int32
func StringToInt64 ¶
StringToInt64 converts a string to int64
func StringToInt8 ¶
StringToInt8 converts a string to int8
func StringToUint ¶
StringToUint converts a string to uint
func StringToUint16 ¶
StringToUint16 converts a string to uint16
func StringToUint32 ¶
StringToUint32 converts a string to uint32
func StringToUint64 ¶
StringToUint64 converts a string to uint64
func StringToUint8 ¶
StringToUint8 converts a string to uint8
func Type ¶
Type converts the input value v of type V to its string representation.
The type V must satisfy the uconst.BasicType constraint.
Example usage:
str := ucast.Type // "123" str := ucast.Type[float64](3.14) // "3.14"
func Uint16ToString ¶
Uint16ToString converts a uint16 to string
func Uint32ToString ¶
Uint32ToString converts a uint32 to string
func Uint64ToString ¶
Uint64ToString converts a uint64 to string
Types ¶
This section is empty.