常用类型及数据操作方法
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.

49 lines
815 B

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