add parsing sumpays
All checks were successful
Build and push image / deploy (push) Successful in 1m44s
All checks were successful
Build and push image / deploy (push) Successful in 1m44s
This commit is contained in:
26
plati/stupidfloat.go
Normal file
26
plati/stupidfloat.go
Normal file
@ -0,0 +1,26 @@
|
||||
package plati
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Stupidfloat float64
|
||||
|
||||
func (f Stupidfloat) Float64() float64 {
|
||||
return float64(f)
|
||||
}
|
||||
|
||||
func (f *Stupidfloat) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
|
||||
floatString := ""
|
||||
err := d.DecodeElement(&floatString, &start)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
floatString = strings.ReplaceAll(floatString, ",", ".")
|
||||
fl64, err := strconv.ParseFloat(floatString, 64)
|
||||
|
||||
*f = Stupidfloat(fl64)
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user