Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PublicVarName ¶
PublicVarName formats a string as a public go variable name
Example ¶
package main import ( "fmt" "github.com/achiku/varfmt" ) func main() { malformattedVars := []string{ "foo", "foo_bar", "fooBar", "foo_bar_buz", "foo_bar___buz", "foo_id", "foo_tls", "foo_json", } for _, s := range malformattedVars { fmt.Printf("%s -> %s\n", s, varfmt.PublicVarName(s)) } }
Output: foo -> Foo foo_bar -> FooBar fooBar -> FooBar foo_bar_buz -> FooBarBuz foo_bar___buz -> FooBarBuz foo_id -> FooID foo_tls -> FooTLS foo_json -> FooJSON
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.