From cf479fb7dc38275fe862be49d31d9fc58cc9fa6f Mon Sep 17 00:00:00 2001 From: Rusty Conover Date: Sun, 18 Feb 2001 23:31:27 +0000 Subject: Fix it so that numbers containing inner zeros will be formatted correctly. 2001-02-18 Rusty Conover * gal/util/e-util.c (e_format_number): Fix it so that numbers containing inner zeros will be formatted correctly. For instance the number 5005 when formatted was coming out as 5,5. It now comes out at 5,005. svn path=/trunk/; revision=8272 --- e-util/e-util.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/e-util/e-util.c b/e-util/e-util.c index e542574d58..02092041f0 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -627,9 +627,11 @@ e_format_number (gint number) int divider; char *value; char *value_iterator; + int initial_grouping; locality = localeconv(); grouping = locality->grouping; + initial_grouping = *grouping; while (number) { char *group; switch (*grouping) { @@ -638,7 +640,11 @@ e_format_number (gint number) grouping++; case 0: divider = epow10(last_count); - group = g_strdup_printf("%d", number % divider); + if(!list && (number/divider) > 0) { + group = g_strdup_printf("%0*d", initial_grouping, number % divider); + } else { + group = g_strdup_printf("%d", number % divider); + } number /= divider; break; case CHAR_MAX: -- cgit