Skip to content

Latest commit

 

History

History
151 lines (106 loc) · 2.75 KB

README.md

File metadata and controls

151 lines (106 loc) · 2.75 KB

A

-- import "github.com/kokizzu/gotro/A"

Usage

func FloatExist

func FloatExist(arr []float64, val float64) bool

FloatExist check if float exists on array

func IntAppendIfNotExists

func IntAppendIfNotExists(arr []int64, str int64) []int64

IntAppendIfNotExists Append if not exists

func IntContains

func IntContains(arr []int64, str int64) bool

IntContains Append int64 to array of string if not exists

func IntJoin

func IntJoin(arr []int64, sep string) string

IntJoin combine int64s in the array of int64 with the chosen string separator

m1 := []int64{123,456}
A.IntJoin(m1,`|`) // 123|456

func IntsAppendIfNotExists

func IntsAppendIfNotExists(arr []int64, ints []int64) []int64

IntsAppendIfNotExists Append slices if not exists

func ParseEmail

func ParseEmail(str_emails, each_name string) []string

ParseEmail split, add alias, and concat emails with name

func StrAppendIfNotExists

func StrAppendIfNotExists(arr []string, str string) []string

StrAppendIfNotExists Append if not exists

func StrContains

func StrContains(arr []string, str string) bool

StrContains Append string to array of string if not exists

func StrJoin

func StrJoin(arr []string, sep string) string

StrJoin combine strings in the array of string with the chosen string separator

m1 := []string{`satu`,`dua`}
A.StrJoin(m1,`-`) // satu-dua

func StrToInt

func StrToInt(arr []string) []int64

StrToInt Convert array of string to array of int64

func main() {
  m := []string{`1`,`2`}
  L.Print(A.StrToInt(m))//output [1 2]
}

convert string list to integer list

func StrsAppendIfNotExists

func StrsAppendIfNotExists(arr []string, strs []string) []string

StrsAppendIfNotExists Append slices if not exists

func ToJson

func ToJson(arr []any) string

ToJson convert map array of string to JSON string type

m := []any{123,`abc`}
L.Print(A.ToJson(m)) // [123,"abc"]

func ToMsgp

func ToMsgp(arr []any) []byte

ToMsgp convert map array of string to MsgPack string type

m := []any{123,`abc`}
L.Print(string(A.ToMsgp(m))) // �{�abc

func UIntJoin

func UIntJoin(arr []uint64, sep string) string

UIntJoin combine uint64s in the array of int64 with the chosen string separator

m1 := []uint64{123,456}
A.UIntJoin(m1,`-`) // 123-456

type MSX

type MSX []map[string]any

MSX array (slice) of map with string key and any value

v := A.MSX{}
v = append(v, map[string]{
  `foo`: 123,
  `bar`: `yay`,
})

type X

type X []any

X array (slice) of anything

v := A.X{}
v = append(v, any_value)