Package strparse provides tools for parsing strings and returning basic Go types, for the Go programming language.
- Go 100%
| go.mod | unix time | |
| go.sum | unix time | |
| LICENSE | initial commits | |
| mustparse.go | strparse.MustParse() | |
| parse.go | unix time | |
| parseelse.go | strparse.ParseElse() | |
| parseok.go | strparse.ParseOK() | |
| parseok_test.go | added support for float32 and float64 | |
| README.md | initial commits | |
| type.go | unix time | |
go-strparse
Package strparse provides tools for parsing strings and returning basic Go types, for the Go programming language.
Documention
Online documentation, which includes examples, can be found at: http://godoc.org/github.com/reiver/go-strparse
Examples
Here is an example of trying to parse a string and returning a uint16:
tcpport,error:=strparse.Parse[uint16]("1234")Here is an example of trying to parse a string and returning a uint16,
but if the string doesn't represent a uint16 number, then defaulting it to 8080:
tcpport:=strparse.ParseElse[uint16]("1234",8080)Import
To import package strparse use import code like the following:
import "github.com/reiver/go-strparse"
Installation
To install package strparse do the following:
GOPROXY=direct go get github.com/reiver/go-strparse
Author
Package strparse was written by Charles Iliya Krempeaux