go-restructure icon indicating copy to clipboard operation
go-restructure copied to clipboard

Add int parsing ?

Open OuesFa opened this issue 6 years ago • 1 comments

Hello,

Was wondering if it's possible to extract int values, here is my code that failed.

type Dummy struct {
	_          struct{} `regexp:"^"`

	DummyInt int      `regexp:"\\d"`

	_          struct{} `regexp:"$"`
}
var dummy Dummy
restructure.Find(&dummy, "1")

fmt.Println(dummy.DummyInt)

May be I'm missing some simple way to do it since I'm discovering go.

Thank you.

OuesFa avatar Nov 24 '19 02:11 OuesFa

Yes this would be a good thing to support. Could use github.com/alexflint/go-scalar.

alexflint avatar Aug 25 '21 20:08 alexflint