package str import ( "fmt" "testing" ) func TestStr_Capitalize(t *testing.T) { fmt.Println(StrTool.Capitalize("hello world!")) //Hello world! fmt.Println(StrTool.CamelCase("hello world!")) //helloWorld! fmt.Println(StrTool.CamelCase("test_ok")) //testOk } func TestStr_UpperFirst(t *testing.T) { fmt.Println(StrTool.UpperFirst("hello world!")) //Hello world! fmt.Println(StrTool.UpperFirst("test_ok")) //Test ok fmt.Println(StrTool.LowerFirst("Hello world!")) //hello world! } func TestStr_PadEnd(t *testing.T) { fmt.Println(StrTool.PadEnd("hello world!", 100, "*")) fmt.Println(StrTool.PadEnd("hello world!", 100, "-")) fmt.Println(StrTool.PadEnd("hello world!", 100, " ")) //hello world!**************************************************************************************** //hello world!---------------------------------------------------------------------------------------- //hello world! } func TestStr_PadStart(t *testing.T) { fmt.Println(StrTool.PadStart("hello world!", 100, "*")) fmt.Println(StrTool.PadStart("hello world!", 100, "-")) fmt.Println(StrTool.PadStart("hello world!", 100, " ")) //****************************************************************************************hello world! //----------------------------------------------------------------------------------------hello world! // hello world! } func TestStr_KebabCase(t *testing.T) { fmt.Println(StrTool.KebabCase("hello world!")) //hello-world fmt.Println(StrTool.KebabCase("test_ok")) //test-ok } func TestStr_SnakeCase(t *testing.T) { fmt.Println(StrTool.SnakeCase("hello world!")) //hello_world fmt.Println(StrTool.SnakeCase("test_ok")) //test_ok } func TestStr_Wrap(t *testing.T) { fmt.Println(StrTool.Wrap("hello world!", "100")) //100hello world!100 } func TestStr_Unwrap(t *testing.T) { fmt.Println(StrTool.Unwrap("100hello world!100", "100")) //hello world! } func TestStr_ReverseStr(t *testing.T) { fmt.Println(StrTool.ReverseStr("hello world!")) //!dlrow olleh } func TestStr_SplitEx(t *testing.T) { fmt.Println(StrTool.SplitEx("hello world!", "world", true)) fmt.Println(StrTool.SplitEx("hello world!", "world", false)) }