(t time.Time, cfmt string)
| 105 | 'x': "15/04/05", 'X': "15:04:05", 'y': "06", 'Y': "2006", 'z': "-0700", 'Z': "MST"} |
| 106 | |
| 107 | func strftime(t time.Time, cfmt string) string { |
| 108 | sc := newFlagScanner('%', "", "", cfmt) |
| 109 | for c, eos := sc.Next(); !eos; c, eos = sc.Next() { |
| 110 | if !sc.ChangeFlag { |
| 111 | if sc.HasFlag { |
| 112 | if v, ok := cDateFlagToGo[c]; ok { |
| 113 | sc.AppendString(t.Format(v)) |
| 114 | } else { |
| 115 | switch c { |
| 116 | case 'w': |
| 117 | sc.AppendString(fmt.Sprint(int(t.Weekday()))) |
| 118 | default: |
| 119 | sc.AppendChar('%') |
| 120 | sc.AppendChar(c) |
| 121 | } |
| 122 | } |
| 123 | sc.HasFlag = false |
| 124 | } else { |
| 125 | sc.AppendChar(c) |
| 126 | } |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | return sc.String() |
| 131 | } |
| 132 | |
| 133 | func isInteger(v LNumber) bool { |
| 134 | return float64(v) == float64(int64(v)) |
no test coverage detected
searching dependent graphs…