collections

package
v2.7.7+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2019 License: MIT Imports: 13 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ToStrings = sprig.GenericFuncMap()["toStrings"].(func(interface{}) []string)

ToStrings converts the supplied parameter into an array of string.

View Source
var TypeConverters = make(map[string]func([]byte, interface{}) error)

TypeConverters is used to register the available converters

Functions

func CenterString

func CenterString(s string, width int) string

CenterString returns string s centered within width

func Concat

func Concat(objects ...interface{}) string

Concat returns a string with all string representation of object concatenated without space.

func ConvertData

func ConvertData(data string, out interface{}) (err error)

ConvertData returns a go representation of the supplied string (YAML, JSON or HCL)

func Default

func Default(value, defaultValue interface{}) interface{}

Default returns the value if it is not empty or default value.

func IIf

func IIf(testValue, valueTrue, valueFalse interface{}) interface{}

IIf acts as a generic ternary operator. It returns valueTrue if testValue is not empty, otherwise, it returns valueFalse

func IfUndef

func IfUndef(def interface{}, values ...interface{}) interface{}

IfUndef returns default value if nothing is supplied as values

func Indent

func Indent(s, indent string) string

Indent returns the indented version of the supplied string.

func IndentN

func IndentN(s string, indent int) string

IndentN returns the indented version (indent as a number of spaces) of the supplied string.

func Interface2string

func Interface2string(str interface{}) string

Interface2string returns the string representation of any interface.

func IsEmptyValue

func IsEmptyValue(v reflect.Value) bool

IsEmptyValue determines if a value is a zero value

func IsExported

func IsExported(id string) bool

IsExported reports whether the identifier is exported.

func JoinLines

func JoinLines(objects ...interface{}) string

JoinLines concatenate the representation of supplied arguments as a string separated by newlines.

func LoadData

func LoadData(filename string, out interface{}) (err error)

LoadData returns a go representation of the supplied file name (YAML, JSON or HCL)

func PrettyPrintStruct

func PrettyPrintStruct(object interface{}) string

PrettyPrintStruct returns a readable version of an object.

func Split2

func Split2(source, sep string) (left, right string)

Split2 returns left and right part of a split.

func SplitLines

func SplitLines(content interface{}) []interface{}

SplitLines return a list of interface object for each line in the supplied content.

func ToBash

func ToBash(value interface{}) string

ToBash returns the bash 4 variable representation of value

func ToInterfaces

func ToInterfaces(values ...string) []interface{}

ToInterfaces converts an array of strings into an array of interfaces

func ToNativeRepresentation

func ToNativeRepresentation(value interface{}) interface{}

ToNativeRepresentation converts any object to native (literals, maps, slices)

func UnIndent

func UnIndent(s string) string

UnIndent returns the unindented version of the supplied string only if all lines are prefixed with the same pattern of spaces.

func WrapString

func WrapString(s string, width int) string

WrapString wraps long string according to the supplied width

Types

type IDictionary

type IDictionary interface {
	Add(key, value interface{}) IDictionary                  // Add value to key (if key exist, convert the key value into list and append the new value).
	AsMap() map[string]interface{}                           // Returns the object casted as map[string]interface{}.
	Clone(...interface{}) IDictionary                        // Returns a distinct copy of the object with only supplied keys. If no keys are supplied, all keys from d are copied.
	Count() int                                              // Simply an alias for Len.
	Create(...int) IDictionary                               // Instantiates a new dictionary of the same type with optional size.
	CreateList(...int) IGenericList                          // Instantiates a list of the same type as current dictionary with optional size and capacity.
	Default(key, defVal interface{}) interface{}             // Returns defVal if dictionary doesn't contain key, otherwise, simply returns entry corresponding to key.
	Delete(interface{}, ...interface{}) (IDictionary, error) // Removes the entry value associated with key. The entry must exist.
	Flush(...interface{}) IDictionary                        // Removes all specified keys from the dictionary. If no key is specified, all keys are removed.
	Get(...interface{}) interface{}                          // Returns the values associated with key.
	GetHelpers() (IDictionaryHelper, IListHelper)            // Returns the helpers implementation associated with the current type.
	GetKeys() IGenericList                                   // Returns the keys in the dictionary in alphabetical order.
	GetValues() IGenericList                                 // Returns the values in the dictionary in alphabetical order of keys.
	Has(...interface{}) bool                                 // Returns true if the dictionary object contains all the key.
	KeysAsString() StringArray                               // Returns the keys in the dictionary in alphabetical order.
	Len() int                                                // Returns the number of keys in the dictionary.
	Merge(IDictionary, ...IDictionary) IDictionary           // Merges the other dictionaries into the current dictionary.
	Native() interface{}                                     // Returns the object casted as native go type (applied recursively).
	Omit(interface{}, ...interface{}) IDictionary            // Returns a distinct copy of the object including all keys except specified ones.
	Pop(...interface{}) interface{}                          // Returns and remove the objects with the specified keys.
	PrettyPrint() string                                     // Returns the pretty string representation of the dictionary.
	Set(key, value interface{}) IDictionary                  // Sets key to value in the dictionary.
	String() string                                          // Returns the string representation of the dictionary.
	Transpose() IDictionary                                  // Transpose keys/values and return the resulting dictionary
	TypeName() String                                        // Returns the actual type name
}

IDictionary represents objects that act as map[string]interface.

func AsDictionary

func AsDictionary(object interface{}) IDictionary

AsDictionary returns the object casted as IDictionary.

func CreateDictionary

func CreateDictionary(size ...int) IDictionary

CreateDictionary instantiates a new dictionary with optional size.

func TryAsDictionary

func TryAsDictionary(object interface{}) (IDictionary, error)

TryAsDictionary returns the object casted as IDictionary if possible.

type IDictionaryHelper

type IDictionaryHelper interface {
	AsDictionary(interface{}) IDictionary                    // Returns the object casted as IDictionary.
	Convert(object interface{}) interface{}                  // Tries to convert the supplied object into IDictionary or IGenericList.
	CreateDictionary(args ...int) IDictionary                // Creates a new IDictionary with optional capacity arguments.
	TryAsDictionary(object interface{}) (IDictionary, error) // Tries to convert any object to IDictionary objects
	TryConvert(object interface{}) (interface{}, bool)       // Tries to convert any object to IGenericList or IDictionary object.
}

IDictionaryHelper represents objects that implement IDictionary compatible objects

var DictionaryHelper IDictionaryHelper

DictionaryHelper configures the default dictionary manager.

type IGenericList

type IGenericList interface {
	Append(...interface{}) IGenericList                     // Add elements to the current list. If list is not large enough, it is enlarged to fit the required size.
	AsArray() []interface{}                                 // Returns the current list as standard array of interface{}.
	Cap() int                                               // Returns the capacity of the list.
	Capacity() int                                          // Simply an alias for Cap.
	Clone() IGenericList                                    // Returns a distinct copy of the object.
	Contains(...interface{}) bool                           // Indicates if the list contains all specified elements
	Count() int                                             // Simply an alias for Len.
	Create(...int) IGenericList                             // Allocates a new list of the same type implementation as this list. Optional arguments are size and capacity.
	CreateDict(...int) IDictionary                          // Instantiates a new dictionary of the same type with optional size.
	First() interface{}                                     // Returns the first element of the list.
	Get(...int) interface{}                                 // Returns the element at position index in the list. If index is out of bound, nil is returned.
	GetHelpers() (IDictionaryHelper, IListHelper)           // Returns the helpers implementation associated with the current type.
	Has(...interface{}) bool                                // Alias for contains
	Intersect(...interface{}) IGenericList                  // Returns a list that is the result of the intersection of the list and the parameters (removing duplicates).
	Join(sep interface{}) String                            // Returns the string representation of the list.
	Last() interface{}                                      // Returns the last element of the list.
	Len() int                                               // Returns the number of elements in the list.
	New(...interface{}) IGenericList                        // Creates a new generic list from the supplied arguments.
	Pop(indexes ...int) (interface{}, IGenericList)         // Removes and returns the elements of the list (if nothing is specified, remove the last element).
	Prepend(...interface{}) IGenericList                    // Add elements to the beginning of the current list. If list is not large enough, it is enlarged to fit the required size.
	PrettyPrint() string                                    // Returns the pretty string representation of the list.
	Remove(indexes ...int) IGenericList                     // Returns a new list without the element specified.
	Reverse() IGenericList                                  // Returns a copy of the current list in reverse order.
	Set(index int, value interface{}) (IGenericList, error) // Sets the value at position index into the list. If list is not large enough, it is enlarged to fit the index.
	String() string                                         // Returns the string representation of the list.
	StringArray() StringArray                               // Returns the current list as StringArray.
	Strings() []string                                      // Returns the current list as list of strings.
	TypeName() String                                       // Returns the actual type name
	Union(...interface{}) IGenericList                      // Returns a list that represents the union of the list and the elements (removing duplicates).
	Unique() IGenericList                                   // Returns a copy of the list removing all duplicate elements.
	Without(...interface{}) IGenericList                    // Returns a copy of the list removing specified elements.
}

IGenericList represents objects that act as []interface{}.

func AsList

func AsList(object interface{}) IGenericList

AsList returns the object casted as IGenericList.

func CreateList

func CreateList(args ...int) IGenericList

CreateList instantiates a new generic list with optional size and capacity.

func NewList

func NewList(objects ...interface{}) IGenericList

NewList instantiates a new generic list from supplied arguments.

func NewStringList

func NewStringList(objects ...string) IGenericList

NewStringList creates a new IGenericList from supplied arguments.

func TryAsList

func TryAsList(object interface{}) (IGenericList, error)

TryAsList returns the object casted as IGenericList if possible.

type IListHelper

type IListHelper interface {
	AsList(interface{}) IGenericList                    // Converts object to IGenericList object. It panics if conversion is impossible.
	Convert(object interface{}) interface{}             // Tries to convert the supplied object into IDictionary or IGenericList.
	CreateList(...int) IGenericList                     // Creates a new IGenericList with optional size/capacity arguments.
	NewList(...interface{}) IGenericList                // Creates a new IGenericList from supplied arguments.
	NewStringList(...string) IGenericList               // Creates a new IGenericList from supplied arguments.
	TryAsList(object interface{}) (IGenericList, error) // Tries to convert any object to IGenericList object.
	TryConvert(object interface{}) (interface{}, bool)  // Tries to convert any object to IGenericList or IDictionary object.
}

IListHelper represents objects that implement IGenericList compatible objects

var ListHelper IListHelper

ListHelper configures the default list manager.

type String

type String string

String is an enhanced class implementation of the standard go string library. This is convenient when manipulating go template string to have it considered as an object.

func (String) AddLineNumber

func (s String) AddLineNumber(space int) String

AddLineNumber adds line number to a string

func (String) Center

func (s String) Center(width int) String

Center returns the string centered within the specified width.

func (String) Compare

func (s String) Compare(b string) int

Compare returns an integer comparing two strings lexicographically. The result will be 0 if a==b, -1 if a < b, and +1 if a > b.

func (String) Contains

func (s String) Contains(substr string) bool

Contains reports whether substr is within s.

func (String) ContainsAny

func (s String) ContainsAny(chars string) bool

ContainsAny reports whether any Unicode code points in chars are within s.

func (String) ContainsRune

func (s String) ContainsRune(r rune) bool

ContainsRune reports whether the Unicode code point r is within s.

func (String) Count

func (s String) Count(substr string) int

Count counts the number of non-overlapping instances of substr in s. If substr is an empty string, Count returns 1 + the number of Unicode code points in s.

func (String) EqualFold

func (s String) EqualFold(t string) bool

EqualFold reports whether s and t, interpreted as UTF-8 strings, are equal under Unicode case-folding.

func (String) Escape

func (s String) Escape() String

Escape returns the representation of the string with escape characters.

func (String) Fields

func (s String) Fields() StringArray

Fields splits the string s around each instance of one or more consecutive white space characters, as defined by unicode.IsSpace, returning an array of substrings of s or an empty list if s contains only white space.

func (String) FieldsFunc

func (s String) FieldsFunc(f func(rune) bool) StringArray

FieldsFunc splits the string s at each run of Unicode code points c satisfying f(c) and returns an array of slices of s. If all code points in s satisfy f(c) or the string is empty, an empty slice is returned. FieldsFunc makes no guarantees about the order in which it calls f(c). If f does not return consistent results for a given c, FieldsFunc may crash.

func (String) FieldsID

func (s String) FieldsID() StringArray

FieldsID splits the string s at character that is not a valid identifier character (letter, digit or underscore).

func (String) GetContextAtPosition

func (s String) GetContextAtPosition(pos int, left, right string) (a String, b int)

GetContextAtPosition tries to extend the context from the specified position within specified boundaries.

func (String) GetWordAtPosition

func (s String) GetWordAtPosition(pos int, accept ...string) (String, int)

GetWordAtPosition returns the selected word and the start position from the specified position.

func (String) HasPrefix

func (s String) HasPrefix(prefix string) bool

HasPrefix tests whether the string s begins with prefix.

func (String) HasSuffix

func (s String) HasSuffix(suffix string) bool

HasSuffix tests whether the string s ends with suffix.

func (String) Indent

func (s String) Indent(indent string) String

Indent returns the indented version of the supplied string (indent represents the string used to indent the lines).

func (String) IndentN

func (s String) IndentN(indent int) String

IndentN returns the indented version of the supplied string (indent represents the number of spaces used to indent the lines).

func (String) Index

func (s String) Index(substr string) int

Index returns the index of the first instance of substr in s, or -1 if substr is not present in s.

func (String) IndexAll

func (s String) IndexAll(substr string) (result []int)

IndexAll returns all positions where substring is found within s.

func (String) IndexAny

func (s String) IndexAny(chars string) int

IndexAny returns the index of the first instance of any Unicode code point from chars in s, or -1 if no Unicode code point from chars is present in s.

func (String) IndexByte

func (s String) IndexByte(c byte) int

IndexByte returns the index of the first instance of c in s, or -1 if c is not present in s.

func (String) IndexFunc

func (s String) IndexFunc(f func(rune) bool) int

IndexFunc returns the index into s of the first Unicode code point satisfying f(c), or -1 if none do.

func (String) IndexRune

func (s String) IndexRune(r rune) int

IndexRune returns the index of the first instance of the Unicode code point r, or -1 if rune is not present in s. If r is utf8.RuneError, it returns the first instance of any invalid UTF-8 byte sequence.

func (String) Join

func (s String) Join(array ...interface{}) String

Join concatenates the elements of array to create a single string. The string object is placed between elements in the resulting string.

func (String) LastIndex

func (s String) LastIndex(substr string) int

LastIndex returns the index of the last instance of substr in s, or -1 if substr is not present in s.

func (String) LastIndexAny

func (s String) LastIndexAny(chars string) int

LastIndexAny returns the index of the last instance of any Unicode code point from chars in s, or -1 if no Unicode code point from chars is present in s.

func (String) LastIndexByte

func (s String) LastIndexByte(c byte) int

LastIndexByte returns the index of the last instance of c in s, or -1 if c is not present in s.

func (String) LastIndexFunc

func (s String) LastIndexFunc(f func(rune) bool) int

LastIndexFunc returns the index into s of the last Unicode code point satisfying f(c), or -1 if none do.

func (String) Len

func (s String) Len() int

Len returns the length of the string.

func (String) Lines

func (s String) Lines() StringArray

Lines splits up s into a StringArray using the newline as character separator

func (String) Map

func (s String) Map(mapping func(rune) rune) String

Map returns a copy of the string s with all its characters modified according to the mapping function. If mapping returns a negative value, the character is dropped from the string with no replacement.

func (String) ParseBool

func (s String) ParseBool() bool

ParseBool returns true if variable exist and is not clearly a false value

i.e. empty, 0, Off, No, n, false, f

func (String) Protect

func (s String) Protect() (result String, array StringArray)

Protect returns a string with all included strings replaced by a token and an array of all replaced strings. The function is able to detect strings enclosed between quotes "" or backtick “ and it detects escaped characters.

func (String) Quote

func (s String) Quote() String

Quote returns the string between quotes.

func (String) Repeat

func (s String) Repeat(count int) String

Repeat returns a new string consisting of count copies of the string s.

It panics if count is negative or if the result of (len(s) * count) overflows.

func (String) Replace

func (s String) Replace(old, new string) String

Replace returns a copy of the string s with the first n non-overlapping instances of old replaced by new. If old is empty, it matches at the beginning of the string and after each UTF-8 sequence, yielding up to k+1 replacements for a k-rune string.

func (String) ReplaceN

func (s String) ReplaceN(old, new string, n int) String

ReplaceN returns a copy of the string s with the first n non-overlapping instances of old replaced by new. If old is empty, it matches at the beginning of the string and after each UTF-8 sequence, yielding up to If n < 0, there is no limit on the number of replacements.

func (String) RestoreProtected

func (s String) RestoreProtected(array StringArray) String

RestoreProtected restores a string transformed by ProtectString to its original value.

func (String) SelectContext

func (s String) SelectContext(pos int, left, right string) String

SelectContext returns the selected word from the specified position.

func (String) SelectWord

func (s String) SelectWord(pos int, accept ...string) String

SelectWord returns the selected word from the specified position.

func (String) Split

func (s String) Split(sep string) StringArray

Split slices s into all substrings separated by sep and returns a slice of the substrings between those separators.

If s does not contain sep and sep is not empty, Split returns a slice of length 1 whose only element is s.

If sep is empty, Split splits after each UTF-8 sequence. If both s and sep are empty, Split returns an empty slice.

It is equivalent to SplitN with a count of -1.

func (String) SplitAfter

func (s String) SplitAfter(sep string) StringArray

SplitAfter slices s into all substrings after each instance of sep and returns a slice of those substrings.

If s does not contain sep and sep is not empty, SplitAfter returns a slice of length 1 whose only element is s.

If sep is empty, SplitAfter splits after each UTF-8 sequence. If both s and sep are empty, SplitAfter returns an empty slice.

It is equivalent to SplitAfterN with a count of -1.

func (String) SplitAfterN

func (s String) SplitAfterN(sep string, n int) StringArray

SplitAfterN slices s into substrings after each instance of sep and returns a slice of those substrings.

The count determines the number of substrings to return:

n > 0: at most n substrings; the last substring will be the unsplit remainder.
n == 0: the result is nil (zero substrings)
n < 0: all substrings

Edge cases for s and sep (for example, empty strings) are handled as described in the documentation for SplitAfter.

func (String) SplitN

func (s String) SplitN(sep string, n int) StringArray

SplitN slices s into substrings separated by sep and returns a slice of the substrings between those separators.

The count determines the number of substrings to return:

n > 0: at most n substrings; the last substring will be the unsplit remainder.
n == 0: the result is nil (zero substrings)
n < 0: all substrings

Edge cases for s and sep (for example, empty strings) are handled as described in the documentation for Split.

func (String) Str

func (s String) Str() string

Str is an abbreviation of String.

func (String) String

func (s String) String() string

String simply convert a String object into a regular string.

func (String) Title

func (s String) Title() String

Title returns a copy of the string s with all Unicode letters that begin words mapped to their title case.

BUG(rsc): The rule Title uses for word boundaries does not handle Unicode punctuation properly.

func (String) ToLower

func (s String) ToLower() String

ToLower returns a copy of the string s with all Unicode letters mapped to their lower case.

func (String) ToLowerSpecial

func (s String) ToLowerSpecial(c unicode.SpecialCase) String

ToLowerSpecial returns a copy of the string s with all Unicode letters mapped to their lower case, giving priority to the special casing rules.

func (String) ToTitle

func (s String) ToTitle() String

ToTitle returns a copy of the string s with all Unicode letters mapped to their title case.

func (String) ToTitleSpecial

func (s String) ToTitleSpecial(c unicode.SpecialCase) String

ToTitleSpecial returns a copy of the string s with all Unicode letters mapped to their title case, giving priority to the special casing rules.

func (String) ToUpper

func (s String) ToUpper() String

ToUpper returns a copy of the string s with all Unicode letters mapped to their upper case.

func (String) ToUpperSpecial

func (s String) ToUpperSpecial(c unicode.SpecialCase) String

ToUpperSpecial returns a copy of the string s with all Unicode letters mapped to their upper case, giving priority to the special casing rules.

func (String) Trim

func (s String) Trim(cutset string) String

Trim returns a slice of the string s with all leading and // trailing Unicode code points contained in cutset removed.

func (String) TrimFunc

func (s String) TrimFunc(f func(rune) bool) String

TrimFunc returns a slice of the string s with all leading and trailing Unicode code points c satisfying f(c) removed.

func (String) TrimLeft

func (s String) TrimLeft(cutset string) String

TrimLeft returns a slice of the string s with all leading Unicode code points contained in cutset removed.

func (String) TrimLeftFunc

func (s String) TrimLeftFunc(f func(rune) bool) String

TrimLeftFunc returns a slice of the string s with all leading Unicode code points c satisfying f(c) removed.

func (String) TrimPrefix

func (s String) TrimPrefix(prefix string) String

TrimPrefix returns s without the provided leading prefix string. If s doesn't start with prefix, s is returned unchanged.

func (String) TrimRight

func (s String) TrimRight(cutset string) String

TrimRight returns a slice of the string s, with all trailing Unicode code points contained in cutset removed.

func (String) TrimRightFunc

func (s String) TrimRightFunc(f func(rune) bool) String

TrimRightFunc returns a slice of the string s with all trailing Unicode code points c satisfying f(c) removed.

func (String) TrimSpace

func (s String) TrimSpace() String

TrimSpace returns a slice of the string s, with all leading and trailing white space removed, as defined by Unicode.

func (String) TrimSuffix

func (s String) TrimSuffix(suffix string) String

TrimSuffix returns s without the provided trailing suffix string. If s doesn't end with suffix, s is returned unchanged.

func (String) UnIndent

func (s String) UnIndent() String

UnIndent returns the string unindented.

func (String) Wrap

func (s String) Wrap(width int) String

Wrap returns the string wrapped with newline when exceeding the specified width.

type StringArray

type StringArray []String

StringArray is an implementation of a array of class String objects.

func (StringArray) Center

func (as StringArray) Center(width int) StringArray

Center applies the corresponding String method on each string in the array.

func (StringArray) Indent

func (as StringArray) Indent(indent string) StringArray

Indent applies the corresponding String method on each string in the array.

func (StringArray) IndentN

func (as StringArray) IndentN(indent int) StringArray

IndentN applies the corresponding String method on each string in the array.

func (StringArray) Join

func (as StringArray) Join(sep interface{}) String

Join joins all lines in the array using sep as the join string.

func (StringArray) Sorted

func (as StringArray) Sorted() StringArray

Sorted apply a sort on the array.

func (StringArray) Str

func (as StringArray) Str() []string

Str is just an abbreviation of Strings.

func (StringArray) Strings

func (as StringArray) Strings() []string

Strings convert array of String objects to an array of regular go string.

func (StringArray) Title

func (as StringArray) Title() StringArray

Title applies the corresponding String method on each string in the array.

func (StringArray) ToLower

func (as StringArray) ToLower() StringArray

ToLower applies the corresponding String method on each string in the array.

func (StringArray) ToLowerSpecial

func (as StringArray) ToLowerSpecial(c unicode.SpecialCase) StringArray

ToLowerSpecial applies the corresponding String method on each string in the array.

func (StringArray) ToTitle

func (as StringArray) ToTitle() StringArray

ToTitle applies the corresponding String method on each string in the array.

func (StringArray) ToTitleSpecial

func (as StringArray) ToTitleSpecial(c unicode.SpecialCase) StringArray

ToTitleSpecial applies the corresponding String method on each string in the array.

func (StringArray) ToUpper

func (as StringArray) ToUpper() StringArray

ToUpper applies the corresponding String method on each string in the array.

func (StringArray) ToUpperSpecial

func (as StringArray) ToUpperSpecial(c unicode.SpecialCase) StringArray

ToUpperSpecial applies the corresponding String method on each string in the array.

func (StringArray) Trim

func (as StringArray) Trim(cutset string) StringArray

Trim applies the corresponding String method on each string in the array.

func (StringArray) TrimFunc

func (as StringArray) TrimFunc(f func(rune) bool) StringArray

TrimFunc applies the corresponding String method on each string in the array.

func (StringArray) TrimLeft

func (as StringArray) TrimLeft(cutset string) StringArray

TrimLeft applies the corresponding String method on each string in the array.

func (StringArray) TrimLeftFunc

func (as StringArray) TrimLeftFunc(f func(rune) bool) StringArray

TrimLeftFunc applies the corresponding String method on each string in the array.

func (StringArray) TrimPrefix

func (as StringArray) TrimPrefix(prefix string) StringArray

TrimPrefix applies the corresponding String method on each string in the array.

func (StringArray) TrimRight

func (as StringArray) TrimRight(cutset string) StringArray

TrimRight applies the corresponding String method on each string in the array.

func (StringArray) TrimRightFunc

func (as StringArray) TrimRightFunc(f func(rune) bool) StringArray

TrimRightFunc applies the corresponding String method on each string in the array.

func (StringArray) TrimSpace

func (as StringArray) TrimSpace() StringArray

TrimSpace applies the corresponding String method on each string in the array.

func (StringArray) TrimSuffix

func (as StringArray) TrimSuffix(suffix string) StringArray

TrimSuffix applies the corresponding String method on each string in the array.

func (StringArray) UnIndent

func (as StringArray) UnIndent() StringArray

UnIndent applies the corresponding String method on each string in the array.

func (StringArray) Wrap

func (as StringArray) Wrap(width int) StringArray

Wrap applies the corresponding String method on each string in the array.

Notes

Bugs

  • The rule Title uses for word boundaries does not handle Unicode punctuation properly.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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