Documentation ¶
Overview ¶
Package strings contains functions to manipulate strings
Index ¶
- func CamelCase(in string) string
- func Indent(width int, indent, s string) (string, error)
- func KebabCase(in string) string
- func ShellQuote(s string) string
- func SkipLines(skip int, in string) (string, error)
- func SnakeCase(in string) string
- func Sort(list []string) []stringdeprecated
- func Trunc(length int, s string) string
- func WordWrap(in string, opts WordWrapOpts) string
- type WordWrapOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Indent ¶
Indent - indent each line of the string with the given indent string. Any indent characters are permitted, except for '\n'.
func ShellQuote ¶
ShellQuote - generate a POSIX shell literal evaluating to a string
func SkipLines ¶
SkipLines - skip the given number of lines (ending with \n) from the string. If skip is greater than the number of lines in the string, an empty string is returned.
func WordWrap ¶
func WordWrap(in string, opts WordWrapOpts) string
WordWrap - insert line-breaks into the string, before it reaches the given width.
Types ¶
type WordWrapOpts ¶
type WordWrapOpts struct { // Line-break sequence to insert (defaults to "\n") LBSeq string // The desired maximum line length in characters (defaults to 80) Width uint32 }
WordWrapOpts defines the options to apply to the WordWrap function
Click to show internal directories.
Click to hide internal directories.