text

package
v0.0.0-...-6b3f725 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CamelCase  = "camelcase"
	LispCase   = "lispcase"
	PascalCase = "pascalcase"
	SnakeCase  = "snakecase"
	Mirror     = "mirror"

	LineLength = 60
)

Variables

This section is empty.

Functions

func CenterAlignedPadded

func CenterAlignedPadded(str, padWith string) string

Consider 60 char width outputs "xyz" as "---- xyz -------"

func Format

func Format(txt string, transformFormat TransformFormat) string

func JoinFormatted

func JoinFormatted(words []string, transformFormat TransformFormat) string

func Split

func Split(src string) (entries []string)

NOTE: This code is copied from https://github.com/fatih/camelcase/blob/master/camelcase.go Splitting rules

  1. If string is not valid UTF-8, return it without splitting as single item array.
  2. Assign all unicode characters into one of 4 sets: lower case letters, upper case letters, numbers, and all other characters.
  3. Iterate through characters of string, introducing splits between adjacent characters that belong to different sets.
  4. Iterate through array of split strings, and if a given string is upper case: if subsequent string is lower case: move last character of upper case string to beginning of lower case string

Types

type TransformFormat

type TransformFormat string

Jump to

Keyboard shortcuts

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