Documentation ¶
Overview ¶
Package stringutil implements string utilities.
Index ¶
- func IsAlpha(r rune) bool
- func IsAlphanumeric(r rune) bool
- func IsLowerAlpha(r rune) bool
- func IsLowerAlphanumeric(r rune) bool
- func IsNumeric(r rune) bool
- func IsUpperAlpha(r rune) bool
- func JoinSliceQuoted(s []string, sep string) string
- func SliceToHumanString(s []string) string
- func SliceToHumanStringOr(s []string) string
- func SliceToHumanStringOrQuoted(s []string) string
- func SliceToHumanStringQuoted(s []string) string
- func SliceToString(s []string) string
- func SliceToUniqueSortedSliceFilterEmptyStrings(s []string) []string
- func SplitTrimLines(output string) []string
- func SplitTrimLinesNoEmpty(output string) []string
- func ToLowerSnakeCase(s string, options ...SnakeCaseOption) string
- func ToPascalCase(s string) string
- func ToUpperSnakeCase(s string, options ...SnakeCaseOption) string
- func TrimLines(output string) string
- type SnakeCaseOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsLowerAlphanumeric ¶
IsLowerAlphanumeric returns true for [0-9a-z].
func JoinSliceQuoted ¶
JoinSliceQuoted joins the slice with quotes.
func SliceToHumanString ¶
SliceToHumanString prints the slice as "e1, e2, and e3".
func SliceToHumanStringOr ¶
SliceToHumanStringOr prints the slice as "e1, e2, or e3".
func SliceToHumanStringOrQuoted ¶
SliceToHumanStringOrQuoted prints the slice as `"e1", "e2", or "e3"`.
func SliceToHumanStringQuoted ¶
SliceToHumanStringQuoted prints the slice as `"e1", "e2", and "e3"`.
func SliceToString ¶
SliceToString prints the slice as [e1,e2].
func SliceToUniqueSortedSliceFilterEmptyStrings ¶
SliceToUniqueSortedSliceFilterEmptyStrings returns a sorted copy of s with no duplicates and no empty strings.
Strings with only spaces are considered empty.
func SplitTrimLines ¶
SplitTrimLines splits the output into individual lines and trims the spaces from each line.
func SplitTrimLinesNoEmpty ¶
SplitTrimLinesNoEmpty splits the output into individual lines and trims the spaces from each line.
This removes any empty lines.
func ToLowerSnakeCase ¶
func ToLowerSnakeCase(s string, options ...SnakeCaseOption) string
ToLowerSnakeCase transforms s to lower_snake_case.
func ToPascalCase ¶
ToPascalCase converts s to PascalCase.
Splits on '-', '_', ' ', '\t', '\n', '\r'. Uppercase letters will stay uppercase,
func ToUpperSnakeCase ¶
func ToUpperSnakeCase(s string, options ...SnakeCaseOption) string
ToUpperSnakeCase transforms s to UPPER_SNAKE_CASE.
Types ¶
type SnakeCaseOption ¶
type SnakeCaseOption func(*snakeCaseOptions)
SnakeCaseOption is an option for snake_case conversions.
func SnakeCaseWithNewWordOnDigits ¶
func SnakeCaseWithNewWordOnDigits() SnakeCaseOption
SnakeCaseWithNewWordOnDigits is a SnakeCaseOption that signifies to split on digits, ie foo_bar_1 instead of foo_bar1.