https://github.com/matusollah/slicestrconv
strconv for slices
https://github.com/matusollah/slicestrconv
boolean conversion float go golang int parser slice strconv uint
Last synced: about 2 months ago
JSON representation
strconv for slices
- Host: GitHub
- URL: https://github.com/matusollah/slicestrconv
- Owner: MatusOllah
- License: mit
- Created: 2024-01-28T16:08:03.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-28T16:21:34.000Z (over 1 year ago)
- Last Synced: 2025-02-09T16:22:48.404Z (3 months ago)
- Topics: boolean, conversion, float, go, golang, int, parser, slice, strconv, uint
- Language: Go
- Homepage:
- Size: 3.91 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# slicestrconv
[](https://pkg.go.dev/github.com/MatusOllah/slicestrconv) [](https://goreportcard.com/report/github.com/MatusOllah/slicestrconv)
**slicestrconv** is a string to slice converting / parsing library for Go. Like strconv but for slices.
## Basic Usage
```go
package mainimport (
"fmt""github.com/MatusOllah/slicestrconv"
)func main() {
boolSlice, err := slicestrconv.ParseBoolSlice("[true, false, true]")
if err != nil {
panic(err)
}fmt.Println(boolSlice) // [true false true]
intSlice, err := slicestrconv.ParseIntSlice("[1, 2, 3, 420, 69]", 10)
if err != nil {
panic(err)
}fmt.Println(intSlice) // [1 2 3 420 69]
floatSlice, err := slicestrconv.ParseFloatSlice("[1.1, 2.2, 3.3, 3.14]", 10)
if err != nil {
panic(err)
}fmt.Println(floatSlice) // [1.1 2.2 3.3 3.14]
}
```