常用类型及数据操作方法
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
781 B

3 years ago
  1. package helper
  2. import (
  3. "testing"
  4. )
  5. func Test_ToInt64(t *testing.T) {
  6. var str interface{} = 45.00
  7. ret := ToInt64(str)
  8. t.Log(ret)
  9. }
  10. func Test_GetRandomNumber(t *testing.T) {
  11. rand := GetRandomNumber(8)
  12. fmt.Println(rand)
  13. }
  14. func Test_GetRandomString(t *testing.T) {
  15. rand := GetRandomString(25)
  16. fmt.Println(rand)
  17. }
  18. func Test_DeleteExtraSpace(t *testing.T) {
  19. s := "c s dfdf dff df x"
  20. s2 := DeleteExtraSpace(s)
  21. t.Log(s2)
  22. }
  23. func Test_StringJoin(t *testing.T) {
  24. s1 := "testing"
  25. s2 := "测试一"
  26. s3 := "二"
  27. s4 := " ,s e"
  28. fmt.Println(StringJoin(s1, s2, s3, s4))
  29. }
  30. func Test_ToString(t *testing.T) {
  31. var str float64 = 0.15
  32. t.Log(str)
  33. ret := ToString(str)
  34. t.Log(ret)
  35. }
  36. func Test_ToInt(t *testing.T) {
  37. var str interface{} = 45
  38. ret := ToInt(str)
  39. t.Log(ret)
  40. }