casefmt

package
v0.0.0-...-7272a43 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2022 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Overview

Package casefmt provides utilities for converting between various ASCII case formats.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CaseFormat

type CaseFormat interface {

	// To converts the specified string from this format to the specified format.
	//
	// A "best effort" approach is taken; if str does not conform to the assumed format, then the behavior is undefined
	// but we make a reasonable effort at converting anyway.
	To(tgtFmt CaseFormat, str string) string
	// contains filtered or unexported methods
}

CaseFormat converts strings between various ASCII case formats.

Behavior is undefined for non-ASCII input.

type LowerCamel

type LowerCamel struct{}

LowerCamel represents the Go variable naming convention, e.g., "lowerCamel".

func (LowerCamel) To

func (c LowerCamel) To(tgtFmt CaseFormat, str string) string

To converts the specified string from this format to the specified format.

A "best effort" approach is taken; if str does not conform to the assumed format, then the behavior is undefined, but we make a reasonable effort at converting anyway.

type LowerHyphen

type LowerHyphen struct{}

LowerHyphen represents the hyphenated variable naming convention, e.g., "lower-hyphen".

func (LowerHyphen) To

func (c LowerHyphen) To(tgtFmt CaseFormat, str string) string

To converts the specified string from this format to the specified format.

A "best effort" approach is taken; if str does not conform to the assumed format, then the behavior is undefined but we make a reasonable effort at converting anyway.

type LowerUnderscore

type LowerUnderscore struct{}

LowerUnderscore represents the C++ variable naming convention, e.g., "lower_underscore".

func (LowerUnderscore) To

func (c LowerUnderscore) To(tgtFmt CaseFormat, str string) string

To converts the specified string from this format to the specified format.

A "best effort" approach is taken; if str does not conform to the assumed format, then the behavior is undefined but we make a reasonable effort at converting anyway.

type UpperCamel

type UpperCamel struct{}

UpperCamel represents the Go export naming convention, e.g., "UpperCamel".

func (UpperCamel) To

func (c UpperCamel) To(tgtFmt CaseFormat, str string) string

To converts the specified string from this format to the specified format.

A "best effort" approach is taken; if str does not conform to the assumed format, then the behavior is undefined but we make a reasonable effort at converting anyway.

type UpperUnderscore

type UpperUnderscore struct{}

UpperUnderscore represents the Java and C++ constant naming convention, e.g., "UPPER_UNDERSCORE".

func (UpperUnderscore) To

func (c UpperUnderscore) To(tgtFmt CaseFormat, str string) string

To converts the specified string from this format to the specified format.

A "best effort" approach is taken; if str does not conform to the assumed format, then the behavior is undefined but we make a reasonable effort at converting anyway.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL