Files
platiparser/plati/stupidfloat.go
dilap54 3bbc6a0baa
All checks were successful
Build and push image / deploy (push) Successful in 1m44s
add parsing sumpays
2023-12-27 00:15:55 +03:00

27 lines
481 B
Go

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
}