std.format expand "%s"
Steven Schveighoffer via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Aug 21 08:39:04 PDT 2017
On 8/21/17 10:58 AM, jmh530 wrote:
> On Monday, 21 August 2017 at 13:57:01 UTC, Steven Schveighoffer wrote:
>>
>> Well, for most things, %s does not do the same thing as another
>> specifier. It's only integers, which format the same as %d, and
>> floating points, which format the same as %g.
>>
>> For all others, the format is specified as %s.
>>
>> I think what you really want is just isFloatingPoint or isIntegral.
>
> I'm pretty sure that isFloatingPoint/isIntegral is not what I need, but
> I'm also not sure if what I was asking for above is needed either. So
> I'll just drop it for now.
What I mean is that %s goes to %d for isIntegral!(typeof(x)), and %s
goes to %g for isFloatingPoint!(typeof(x)), and stays as %s for
everything else.
Given this, you could probably write the function you were looking for.
-Steve
More information about the Digitalmars-d-learn
mailing list