stringsx

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: MIT Imports: 9 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Atoi

func Atoi(s string) (int, error)

func LowerCamelCase

func LowerCamelCase(name string) string

LowerCamelCase e.g. iAmA10YearsSenior

func LowerDashJoint

func LowerDashJoint(name string) string

LowerDashJoint e.g. i-am-a-10-years-senior

func LowerSnakeCase

func LowerSnakeCase(name string) string

LowerSnakeCase e.g. i_am_a_10_years_senior

func Random added in v0.2.9

func Random(n int) string

func RandomN added in v0.2.9

func RandomN(n int) string

func SplitCamelCase added in v0.4.1

func SplitCamelCase(src string) (parts []string)

SplitCamelCase splits the camelcase word and returns a list of words. It also supports digits. Both lower camel case and upper camel case are supported. For more info please check: http://en.wikipedia.org/wiki/CamelCase 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

func SplitToWords

func SplitToWords(s string) []string

func UpperCamelCase

func UpperCamelCase(name string) string

UpperCamelCase e.g. IAmA10YearsSenior

func UpperSnakeCase

func UpperSnakeCase(name string) string

UpperSnakeCase e.g. I_AM_A_10_YEARS_SENIOR

func ValidFlagKey added in v0.2.0

func ValidFlagKey(s string) bool

func ValidFlagName added in v0.2.0

func ValidFlagName(s string) bool

func ValidFlagOptionKey added in v0.2.0

func ValidFlagOptionKey(s string) bool

func ValidIdentifier added in v0.2.0

func ValidIdentifier(s string) bool

func ValidUnquotedOptionValue added in v0.2.0

func ValidUnquotedOptionValue(s string) bool

Types

type LetterType

type LetterType int

Jump to

Keyboard shortcuts

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