From 50d4224d412ba9e84355a237379f6cf55bd1db0e Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Sat, 14 Apr 2018 00:40:17 +0200 Subject: [PATCH] fixes #6205 --- changelog.md | 3 +++ lib/pure/strutils.nim | 38 +++++++++++++++++++------------------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/changelog.md b/changelog.md index 30d9c6f2ba..60e9933596 100644 --- a/changelog.md +++ b/changelog.md @@ -20,6 +20,9 @@ containing the column of the instantiation. - ``cookies.setCookie` no longer assumes UTC for the expiration date. +- ``strutils.formatEng`` does not distinguish between ``nil`` and ``""`` + strings anymore for its ``unit`` parameter. Instead the space is controlled + by a new parameter ``useUnitSpace``. #### Breaking changes in the compiler diff --git a/lib/pure/strutils.nim b/lib/pure/strutils.nim index ddd0e9e620..7b8a9a0d04 100644 --- a/lib/pure/strutils.nim +++ b/lib/pure/strutils.nim @@ -2144,12 +2144,13 @@ proc formatEng*(f: BiggestFloat, precision: range[0..32] = 10, trim: bool = true, siPrefix: bool = false, - unit: string = nil, - decimalSep = '.'): string {.noSideEffect.} = + unit: string = "", + decimalSep = '.', + useUnitSpace = false): string {.noSideEffect.} = ## Converts a floating point value `f` to a string using engineering notation. ## ## Numbers in of the range -1000.0