strings.c
changeset 4377 0fb9077b8173
parent 4346 3f00094f2670
child 4386 04c0a9fe59c9
--- a/strings.c	Fri Aug 25 00:35:11 2006 +0000
+++ b/strings.c	Fri Aug 25 00:41:10 2006 +0000
@@ -381,9 +381,11 @@
 		number = -number;
 	}
 
-	// add prefix part
-	s = spec->prefix;
-	while (s != spec->prefix + lengthof(spec->prefix) && (c = *s++) != '\0') *buff++ = c;
+	/* add prefix part, only if it is specified by symbol_pos */
+	if (spec->symbol_pos == 0) {
+		s = spec->prefix;
+		while (s != spec->prefix + lengthof(spec->prefix) && (c = *(s++)) != '\0') *(buff)++ = c;
+	}
 
 	// for huge numbers, compact the number into k or M
 	if (compact) {
@@ -411,9 +413,11 @@
 
 	if (compact) *buff++ = compact;
 
-	// add suffix part
-	s = spec->suffix;
-	while (s != spec->suffix + lengthof(spec->suffix) && (c = *s++) != '\0') *buff++ = c;
+	/* add suffix part, only if it is specified by symbol_pos */
+	if (spec->symbol_pos != 0) {
+		s = spec->suffix;
+		while (s != spec->suffix + lengthof(spec->suffix) && (c = *(s++)) != '\0') *(buff++) = c;
+	}
 
 	return buff;
 }