https://github.com/xuanjinliang/go_array
Go Slice operates like a JavaScript Array
https://github.com/xuanjinliang/go_array
array go javascript-array slice
Last synced: 2 months ago
JSON representation
Go Slice operates like a JavaScript Array
- Host: GitHub
- URL: https://github.com/xuanjinliang/go_array
- Owner: xuanjinliang
- Created: 2020-02-25T06:13:56.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-11T03:46:35.000Z (about 6 years ago)
- Last Synced: 2024-06-20T12:07:01.793Z (almost 2 years ago)
- Topics: array, go, javascript-array, slice
- Language: Go
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go_array
Go Slice operates like a JavaScript Array
# How to use?
You have to declare an Array object:
```cassandraql
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:
```cassandraql
array.GetData().([]int)
```
- Len: Return array length
- ForEach
- Concat
- CopyWithin ........
#### There are detailed examples in the code