gocase

package module
Version: v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2019 License: MIT Imports: 1 Imported by: 3

README

gocase

CircleCI GoDoc

A golang package to convert normal CamelCase to Golang's CamelCase and vice versa. Golang's CamelCase means a string that takes into account to Go's common initialisms.

Example

  • To: converts a string from From to To.
  • Revert: converts a string from To to From.
From To
"" ""
"jsonFile" "jsonFile"
"IpAddress" "IPAddress"
"defaultDnsServer" "defaultDNSServer"
"somethingHttpApiId" "somethingHTTPAPIID"

Reference

For more details, please see golint package.

Documentation

Overview

Package gocase is a package to convert normal CamelCase to Golang's CamelCase and vice versa. Golang's CamelCase means a string that takes into account to Go's common initialisms. For more details, see `golang.org/x/lint/golint`.

Example
package main

import (
	"fmt"

	"github.com/takuoki/gocase"
)

func main() {
	fmt.Println(gocase.To("IpAddress"))
	fmt.Println(gocase.Revert("defaultDNSServer"))

}
Output:

IPAddress
defaultDnsServer

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Revert

func Revert(s string) string

Revert returns a string converted from Go case to normal case.

func To

func To(s string) string

To returns a string converted to Go case.

Types

This section is empty.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL