2023-05-05 13:43:33 +08:00
|
|
|
// Package wrapper ...
|
|
|
|
//
|
|
|
|
// Description : wrapper ...
|
|
|
|
//
|
|
|
|
// Author : go_developer@163.com<白茶清欢>
|
|
|
|
//
|
|
|
|
// Date : 2023-05-05 13:39
|
|
|
|
package wrapper
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestString_ToFloat32(t *testing.T) {
|
|
|
|
var str String
|
|
|
|
str = "12345.123"
|
|
|
|
fmt.Println(str)
|
|
|
|
fmt.Println(str.ToFloat32())
|
|
|
|
fmt.Println(str.ToFloat64())
|
|
|
|
fmt.Println(str.ToNumber())
|
|
|
|
fmt.Println(str.ToDouble())
|
|
|
|
fmt.Println(str.ToInt())
|
|
|
|
fmt.Println(str.ToUint())
|
|
|
|
}
|
2024-01-23 10:42:03 +08:00
|
|
|
|
|
|
|
func TestString_ToAnySlice(t *testing.T) {
|
|
|
|
str := "1,2,3"
|
|
|
|
r := String(str).ToAnySlice(",")
|
|
|
|
fmt.Println(r)
|
|
|
|
}
|