Skip to content

Commit

Permalink
Create README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
MatusOllah committed Jan 28, 2024
1 parent dc01392 commit f03db3d
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# slicestrconv

[![Go Reference](https://pkg.go.dev/badge/github.com/MatusOllah/slicestrconv.svg)](https://pkg.go.dev/github.com/MatusOllah/slicestrconv) [![Go Report Card](https://goreportcard.com/badge/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 main

import (
"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]
}
```

0 comments on commit f03db3d

Please sign in to comment.