Documentation
¶
Index ¶
- func AppendSlices(first, second []string) []string
- func Reverse[T any](in []T) []T
- func ReverseString(in []string) []string
- func SortAsc(slice []int)
- func SortDesc(slice []int)
- func ToInt64(in []int) []int64
- func TypeOf[T any](in []T) string
- type ElementExist
- type IntSlice
- type StringArray
- func (sa StringArray) AppendElementToTheEnd(element string) []string
- func (sa StringArray) AppendElementToTheFirst(element string) []string
- func (sa StringArray) AttachElements() string
- func (sa StringArray) AttachElementsBySpace() string
- func (sa StringArray) CountElements() int
- func (sa StringArray) DeleteElement(element string) []string
- func (sa StringArray) ElementExist(element string) ElementExist
- func (sa StringArray) ElementsIndexMapper() map[int]string
- func (sa StringArray) ReverseRange(i int) (int, string)
- func (sa StringArray) ShiftElements(n int) []string
- func (sa StringArray) ToDigits() []int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendSlices ¶
AppendSlices appends two slices
func ReverseString ¶
ReverseString gets an array of strings and reverses its elements
Types ¶
type ElementExist ¶
type IntSlice ¶
type IntSlice []int
digit slices
func NewIntSlice ¶
type StringArray ¶
type StringArray []string
func NewStringArray ¶
func NewStringArray(in []string) StringArray
NewStringArray converts an array of strings to a StringArray
func (StringArray) AppendElementToTheEnd ¶
func (sa StringArray) AppendElementToTheEnd(element string) []string
AppendElementToTheEnd appends an element to the end of an string arrey
func (StringArray) AppendElementToTheFirst ¶
func (sa StringArray) AppendElementToTheFirst(element string) []string
AppendElementToTheFirst appends an element to the very first of an string arrey
func (StringArray) AttachElements ¶
func (sa StringArray) AttachElements() string
AttachElements concatenates the elements of a StringArray into a single string
func (StringArray) AttachElementsBySpace ¶
func (sa StringArray) AttachElementsBySpace() string
AttachElementsBySpace concatenates the elements of a StringArray into a single string separated by spaces
func (StringArray) CountElements ¶
func (sa StringArray) CountElements() int
CountElements returns the number of elements in a StringArray
func (StringArray) DeleteElement ¶
func (sa StringArray) DeleteElement(element string) []string
TODO: complete this ...
func (StringArray) ElementExist ¶
func (sa StringArray) ElementExist(element string) ElementExist
ElementExist checks if an element exists in a StringArray and returns its index
func (StringArray) ElementsIndexMapper ¶
func (sa StringArray) ElementsIndexMapper() map[int]string
ElementsIndexMapper maps arrays element to its index
func (StringArray) ReverseRange ¶
func (sa StringArray) ReverseRange(i int) (int, string)
ReverseRange iterates on the string array backwardly
sample usage :
arr := []string{"one","two","three"} index := 0 for (
if index == len(arr) {
break()
}
i,v := arr.ReverseRange(index)
index ++
)
func (StringArray) ShiftElements ¶
func (sa StringArray) ShiftElements(n int) []string
ShiftElements to shift to the right use minus digits and positive digits to shift to the left
func (StringArray) ToDigits ¶
func (sa StringArray) ToDigits() []int
ToDigits converts the string elements to digits and return the corresponding int array