strings

package
v3.5.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2019 License: MIT Imports: 4 Imported by: 18

Documentation

Overview

Package strings contains functions to manipulate strings

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CamelCase

func CamelCase(in string) string

CamelCase -

func Indent

func Indent(width int, indent, s string) string

Indent - indent each line of the string with the given indent string

func KebabCase

func KebabCase(in string) string

KebabCase -

func SnakeCase

func SnakeCase(in string) string

SnakeCase -

func Sort deprecated

func Sort(list []string) []string

Sort - return an alphanumerically-sorted list of strings

Deprecated: use coll.Sort instead

func Trunc

func Trunc(length int, s string) string

Trunc - truncate a string to the given length

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 {
	// The desired maximum line length in characters (defaults to 80)
	Width uint

	// Line-break sequence to insert (defaults to "\n")
	LBSeq string
}

WordWrapOpts defines the options to apply to the WordWrap function

Jump to

Keyboard shortcuts

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