abbrev
#
func abbrev(width int, str string) string
Truncates a string with ellipses (...).
abbrevboth
#
func abbrevboth(left int, right int, str string) string
Abbreviates both sides with ellipses (...).
camelcase
#
func camelcase(str string) string
Converts string from snake_case to CamelCase.
cat
#
func cat(args ...interface{}) string
Concatenates multiple strings together into one, separating them with
spaces.
containsSprig
#
func containsSprig(substr string, str string) bool
Tests to see if one string is contained inside of another.
Aliases
#
hasPrefix
#
func hasPrefix(prefix string, str string) bool
Tests whether a string has a given prefix.
hasSuffix
#
func hasSuffix(suffix string, str string) bool
Tests whether a string has a given suffix.
indentSprig
#
func indentSprig(spaces int, str string) string
Indents every line in a given string to the specified indent width.
This is useful when aligning multi-line strings.
Aliases
#
initials
#
func initials(str string) string
Given multiple words, takes the first letter of each word and combine.
kebabcase
#
func kebabcase(str string) string
Convert string from camelCase to kebab-case.
lower
#
func lower(str string) string
Converts the entire string to lowercase.
nindentSprig
#
func nindentSprig(spaces int, str string) string
Same as the indent function, but prepends a new line to the beginning
of the string.
Aliases
#
nospace
#
func nospace(str string) string
Removes all whitespace from a string.
plural
#
func plural(one string, many string, count int) string
Pluralizes a string.
quote
#
func quote(str ...interface{}) string
Wraps each argument with double quotes.
randAlpha
#
func randAlpha(count int) string
Generates random string with letters.
randAlphaNum
#
func randAlphaNum(count int) string
Generates random string with letters and digits.
randAscii
#
func randAscii(count int) string
Generates random string with ASCII printable characters.
randNumeric
#
func randNumeric(count int) string
Generates random string with digits.
repeatSprig
#
func repeatSprig(count int, str string) string
Repeats a string multiple times.
Aliases
#
replace
#
func replace(old string, new string, src string) string
Performs simple string replacement.
shuffle
#
func shuffle(str string) string
Shuffle a string.
snakecase
#
func snakecase(str string) string
Converts string from camelCase to snake_case.
squote
#
func squote(args ...interface{}) string
Wraps each argument with single quotes.
substr
#
func substr(start int, length int, str string) string
Get a substring from a string.
swapcase
#
func swapcase(str string) string
Swaps the uppercase to lowercase and lowercase to uppercase.
title
#
func title(str string) string
Converts to title case.
toString
#
func toString(value interface{}) string
Converts any value to string.
trim
#
func trim(str string) string
Removes space from either side of a string.
trimAll
#
func trimAll(chars string, str string) string
Removes given characters from the front or back of a string.
Aliases
#
trimPrefix
#
func trimPrefix(prefix string, str string) string
Trims just the prefix from a string if present.
trimSuffix
#
func trimSuffix(suffix string, str string) string
Trims just the suffix from a string if present.
truncSprig
#
func truncSprig(length int, str string) string
Truncates a string (and add no suffix).
Aliases
#
untitle
#
func untitle(str string) string
Removes title casing.
upper
#
func upper(str string) string
Converts the entire string to uppercase.
wrapSprig
#
func wrapSprig(length int, str string) string
Wraps text at a given column count.
Aliases
#
wrapWith
#
func wrapWith(length int, spe string, str string) string
Works as wrap, but lets you specify the string to wrap with (wrap uses
\n).