stringx

package
v0.0.0-...-c63aa1e Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func After

func After(s string, substr string) string

After returns substring after substr.

func AfterWord

func AfterWord(s, substr string) string

AfterWord returns a word after substr from the split string

func Before

func Before(s string, substr string) string

Before returns substring before substr.

func Between

func Between(s, start, end string) string

Between returns substring between two strings.

func BetweenIndex

func BetweenIndex(s, start, end string) (int, int)

BetweenIndex returns start and end indexes between two strings.

func ContainsAny

func ContainsAny(s string, substr ...string) bool

ContainsAny returns true if the s contains any ony of the substr

func ConvertCase

func ConvertCase(s string, inputCase, outputCase StyleCase) string

func ConvertStringToCase

func ConvertStringToCase(s string, outputCase StyleCase) string

func FirstLower

func FirstLower(s string) string

func FirstUpper

func FirstUpper(s string) string

func HasPrefixes

func HasPrefixes(s string, prefix ...string) bool

HasPrefixes returns string contains any one of the prefixes.

func HasStrings

func HasStrings(s string, substr ...string) bool

HasStrings returns true if the s equal any one of the substr

func HasSuffixes

func HasSuffixes(s string, suffix ...string) bool

HasSuffixes returns string contains any one of the suffixes.

func SplitAfter

func SplitAfter(s, sep, substr string) string

SplitAfter returns a string after substr from the split string

func SplitByIndex

func SplitByIndex(s, sep string, index int) string

SplitByIndex returns a string by index from the split string

func SplitCamelCase

func SplitCamelCase(s string) []string

func SplitKebabCase

func SplitKebabCase(s string) []string

func SplitSnakeCase

func SplitSnakeCase(s string) []string

func Title

func Title(s string) string

func ToCamel

func ToCamel(values []string, firstWordLower bool) string

func ToKebab

func ToKebab(values []string) string

func ToKebabAllUpper

func ToKebabAllUpper(values []string) string

func ToPlural

func ToPlural(s string) string

func ToSnake

func ToSnake(values []string) string

func ToSnakeAllUpper

func ToSnakeAllUpper(values []string) string

Types

type StyleCase

type StyleCase int
const (
	NoneCase StyleCase = iota
	// CamelCase is CamelCase
	CamelCase
	// CamelCaseFirstLower is camelCase
	CamelCaseFirstLower
	// SnakeCase is snake_case
	SnakeCase
	// SnakeCaseAllUpper is SNAKE_CASE
	SnakeCaseAllUpper
	// KebabCase is kebab-case
	KebabCase
	// KebabCaseAllUpper is KEBAB-CASE
	KebabCaseAllUpper
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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