Skip to content

Commit 7ed3649

Browse files
Jilledustin
authored andcommitted
Replace RenderFloat with FormatFloat
I suppose it was previously named RenderFloat
1 parent 52939b8 commit 7ed3649

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎number.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ var (
4646
// * decimal separator
4747
// * decimal precision
4848
//
49-
// Usage: s := RenderFloat(format, n)
49+
// Usage: s := FormatFloat(format, n)
5050
// The format parameter tells how to render the number n.
5151
//
5252
// See examples: http://play.golang.org/p/LXc1Ddm1lJ
@@ -111,7 +111,7 @@ func FormatFloat(format string, n float64) string {
111111
// +0000
112112
if formatIndx[0] == 0 {
113113
if format[formatIndx[0]] != '+' {
114-
panic("RenderFloat(): invalid positive sign directive")
114+
panic("FormatFloat(): invalid positive sign directive")
115115
}
116116
positiveStr = "+"
117117
formatIndx = formatIndx[1:]
@@ -125,7 +125,7 @@ func FormatFloat(format string, n float64) string {
125125
// 000,000.00
126126
if len(formatIndx) == 2 {
127127
if (formatIndx[1] - formatIndx[0]) != 4 {
128-
panic("RenderFloat(): thousands separator directive must be followed by 3 digit-specifiers")
128+
panic("FormatFloat(): thousands separator directive must be followed by 3 digit-specifiers")
129129
}
130130
thousandStr = string(format[formatIndx[0]])
131131
formatIndx = formatIndx[1:]

‎number_test.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ func TestFormatFloat(t *testing.T) {
5252
}
5353
// Test the things that could panic
5454
panictests := []TestStruct{
55-
{"RenderFloat(): invalid positive sign directive", "-", 12345.6789, "12,345.68"},
56-
{"RenderFloat(): thousands separator directive must be followed by 3 digit-specifiers", "0.01", 12345.6789, "12,345.68"},
55+
{"FormatFloat(): invalid positive sign directive", "-", 12345.6789, "12,345.68"},
56+
{"FormatFloat(): thousands separator directive must be followed by 3 digit-specifiers", "0.01", 12345.6789, "12,345.68"},
5757
}
5858
for _, test := range panictests {
5959
didPanic := false

0 commit comments

Comments
 (0)