21
0

add commaformatter

This commit is contained in:
Liu Ming 2017-08-18 11:10:25 +08:00
parent d3f14f70d8
commit b3daf1a0f9

View File

@ -18,7 +18,6 @@ func (f *Formatter) Format(val float64, date1904 bool) string {
itemFormatString, _ := i.translateToGolangFormat() itemFormatString, _ := i.translateToGolangFormat()
gf += itemFormatString gf += itemFormatString
} }
fmt.Println(f)
if f.typ == DATEFORMAT { if f.typ == DATEFORMAT {
t := TimeFromExcelTime(val, date1904) t := TimeFromExcelTime(val, date1904)
return t.Format(gf) return t.Format(gf)
@ -48,6 +47,22 @@ func (self *basicFormatter) String() string {
return fmt.Sprintf("basic formatter as (%s)", self.origin) return fmt.Sprintf("basic formatter as (%s)", self.origin)
} }
type commaFormatter struct {
basicFormatter
}
func (self *commaFormatter) translateToGolangFormat() (string, error) {
return self.origin, nil
}
func (self *commaFormatter) setOriginal(o string) {
self.origin = o
}
func (self *commaFormatter) String() string {
return fmt.Sprintf("basic formatter as (%s)", self.origin)
}
type YearFormatter struct { type YearFormatter struct {
basicFormatter basicFormatter
} }