|
|
- package helper
-
- import (
- "fmt"
- "strings"
- "testing"
- )
-
- func Test_ToInt64(t *testing.T) {
- var str interface{} = 45.00
- ret := ToInt64(str)
- t.Log(ret)
- }
-
- func Test_GetRandomNumber(t *testing.T) {
- rand := GetRandomNumber(8)
- fmt.Println(rand)
- }
- func Test_GetRandomString(t *testing.T) {
- rand := GetRandomString(25)
- fmt.Println(rand)
- }
-
- func Test_DeleteExtraSpace(t *testing.T) {
- s := "c s dfdf dff df x"
- s2 := DeleteExtraSpace(s)
- t.Log(s2)
- }
-
- func Test_StringJoin(t *testing.T) {
- s1 := "testing"
- s2 := "测试一"
- s3 := "二"
- s4 := " ,s e"
- fmt.Println(StringJoin(s1, s2, s3, s4))
- }
-
- func Test_ToString(t *testing.T) {
-
- var str float64 = 0.15
- t.Log(str)
- ret := ToString(str)
- t.Log(ret)
- }
-
- func Test_StrFirstToUpper(t *testing.T) {
- var str string = "departmentID"
- ret := StrFirstToUpper(str)
- t.Log(ret)
- }
-
- func Test_ToInt(t *testing.T) {
- var str string = "sd23455667,123456789aq,qq123456789"
- ret := ToInt(str)
- t.Log(ret)
- }
- func Test_IsInStringArray(t *testing.T) {
- var s string = "1,19,37,220,351,466,585,655,801,820,933,1046,1168,1263,1375,1532,1709,1827,1965,1977,1988,2003,2011,2017,2025,2035,2041,2050,2056,2065,2070,2077,2082,2091,2123,2146,2150,2156,2162,2291,2323,2367,2572,2670,2816,2898,3022,3126,3178,3206,3325,3716,3738"
- arr := strings.Split(s, ",")
-
- t.Log(IsInStringArray(arr, "351"))
- }
|