13518219792

建站动态

根据您的个性需求进行定制 先人一步 抢占小程序红利时代

创新互联GoFrame教程:GoFramegstr-命名转换

CaseCamel

CaseCamel(s string) string

func ExampleCaseCamel() {
	var (
		str    = `hello world`
		result = gstr.CaseCamel(str)
	)
	fmt.Println(result)

	// Output:
	// HelloWorld
}

CaseCamelLower

CaseCamelLower(s string) string

func ExampleCaseCamelLower() {
	var (
		str    = `hello world`
		result = gstr.CaseCamelLower(str)
	)
	fmt.Println(result)

	// Output:
	// helloWorld
}

CaseSnake

CaseSnake(s string) string

func ExampleCaseSnake() {
	var (
		str    = `hello world`
		result = gstr.CaseSnake(str)
	)
	fmt.Println(result)

	// Output:
	// hello_world
}

CaseSnakeScreaming

CaseSnakeScreaming(s string) string

func ExampleCaseSnakeScreaming() {
	var (
		str    = `hello world`
		result = gstr.CaseSnakeScreaming(str)
	)
	fmt.Println(result)

	// Output:
	// HELLO_WORLD
}

CaseSnakeFirstUpper

CaseSnakeFirstUpper(word string, underscore ...string) string

func ExampleCaseSnakeFirstUpper() {
	var (
		str    = `RGBCodeMd5`
		result = gstr.CaseSnakeFirstUpper(str)
	)
	fmt.Println(result)

	// Output:
	// rgb_code_md5
}

CaseKebab

CaseKebab(s string) string

func ExampleCaseKebab() {
	var (
		str    = `hello world`
		result = gstr.CaseKebab(str)
	)
	fmt.Println(result)

	// Output:
	// hello-world
}

CaseKebabScreaming

CaseKebabScreaming(s string) string

func ExampleCaseKebabScreaming() {
	var (
		str    = `hello world`
		result = gstr.CaseKebabScreaming(str)
	)
	fmt.Println(result)

	// Output:
	// HELLO-WORLD
}

CaseDelimited

CaseDelimited(s string, del byte) string

func ExampleCaseDelimited() {
	var (
		str    = `hello world`
		del    = byte('-')
		result = gstr.CaseDelimited(str, del)
	)
	fmt.Println(result)

	// Output:
	// hello-world
}

CaseDelimitedScreaming

CaseDelimitedScreaming(s string, del uint8, screaming bool) string

func ExampleCaseDelimitedScreaming() {
	{
		var (
			str    = `hello world`
			del    = byte('-')
			result = gstr.CaseDelimitedScreaming(str, del, true)
		)
		fmt.Println(result)
	}
	{
		var (
			str    = `hello world`
			del    = byte('-')
			result = gstr.CaseDelimitedScreaming(str, del, false)
		)
		fmt.Println(result)
	}

	// Output:
	// HELLO-WORLD
	// hello-world
}

新闻名称:创新互联GoFrame教程:GoFramegstr-命名转换
转载来源:http://cdbrznjsb.com/article/djoehpe.html

其他资讯

让你的专属顾问为你服务