Skip to content

xuanjinliang/go_array

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go_array

Go Slice operates like a JavaScript Array

How to use?

You have to declare an Array object:

    var sliceData = []int{1, 2, 3}
    array, err := Array(sliceData)
    if err != nil {
        fmt.Errorf("%v", err.Error())
    }
    str := array.ToString()
    fmt.Println(str) // 1,2,3

Methods

  • GetData: Return interface array data, you can use assertions, for example:
    array.GetData().([]int)
  • Len: Return array length
  • ForEach
  • Concat
  • CopyWithin ........

There are detailed examples in the code

About

Go Slice operates like a JavaScript Array

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages