strings

package
v0.11.3 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Atoi64 added in v0.9.3

func Atoi64(s string) int64

func Atoui added in v0.9.3

func Atoui(s string) uint

func Atoui64 added in v0.9.3

func Atoui64(s string) uint64

func Choose added in v0.7.0

func Choose(cond bool, trueVal, falseVal string) string

Choose is like the ternary operator ?. It returns the first string on true, and the second on false.

func EndsWith

func EndsWith(s string, ending string) bool

EndsWith returns true if the string ends with the ending string.

func ExtractNumbers added in v0.7.1

func ExtractNumbers(in string) (out string)

func HasOnlyLetters added in v0.7.0

func HasOnlyLetters(s string) bool

HasOnlyLetters will return false if any of the characters in the string do not pass the unicode.IsLetter test.

func Indent added in v0.2.0

func Indent(s string) string

Indent will indent very line of the string with a tab

func JoinContent added in v0.7.0

func JoinContent(sep string, items ...string) string

JoinContent joins strings together with the separator sep. Only strings that are not empty strings are joined.

func KebabToCamel added in v0.2.4

func KebabToCamel(s string) string

func LcFirst

func LcFirst(s string) string

LcFirst makes sure the first character in the string is lower case.

func PasswordString added in v0.9.3

func PasswordString(n int) string

PasswordString generates a pseudo random password with the given length using characters that are common in passwords. We attempt to leave out letters that are easily visually confused. Specific letters excluded are lowercase l, upper case I and the number 1, upper case O and the number 0 Also, only easily identifiable and describable symbols are used. It also tries to protect against accidentally creating an easily guessed value by making sure the password has at least one lower-case letter, one upper-case letter, one number, and one symbol. n must be at least 4

func RandomString added in v0.9.3

func RandomString(source string, n int) string

RandomString generates a pseudo random string of the given length using the given characters. The distribution is not perfect, but works for general purposes

func SnakeToKebab added in v0.9.3

func SnakeToKebab(s string) string

func StartsWith

func StartsWith(s string, beginning string) bool

StartsWith returns true if the string begins with the beginning string.

func Title added in v0.2.0

func Title(s string) string

Title is a more advanced titling operation, that will convert underscores to spaces, and add spaces to CamelCase words

Types

This section is empty.

Jump to

Keyboard shortcuts

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