Package strparse provides tools for parsing strings and returning basic Go types, for the Go programming language.
Find a file
2026-02-25 19:51:26 -08:00
go.mod go.* 2025-09-10 05:57:40 -07:00
go.sum go.* 2025-09-10 05:57:40 -07:00
LICENSE initial commits 2025-09-10 05:57:07 -07:00
mustparse.go strparse.MustParse() 2025-09-10 06:07:49 -07:00
parse.go added support for []string 2026-02-25 19:51:26 -08:00
parseelse.go strparse.ParseElse() 2025-09-10 06:02:31 -07:00
parseok.go strparse.ParseOK() 2025-09-10 06:14:49 -07:00
parseok_test.go added support for []string 2026-02-25 19:51:26 -08:00
README.md initial commits 2025-09-10 05:57:07 -07:00
type.go added support for []string 2026-02-25 19:51:26 -08:00

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

GoDoc

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