Skip to content

Commit

Permalink
Merge pull request #1122 from AndrejMitrovic/Fixup1115
Browse files Browse the repository at this point in the history
Fixup Pull1555 - Zero-arg text() should return null string.
  • Loading branch information
alexrp committed Feb 7, 2013
2 parents ad44a7d + ec1dcf5 commit 4d59ddc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions std/conv.d
Original file line number Diff line number Diff line change
Expand Up @@ -3133,6 +3133,11 @@ dstring dtext(T...)(T args)
return textImpl!dstring(args);
}

private S textImpl(S, U...)(U args) if (U.length == 0)
{
return null;
}

private S textImpl(S, U...)(U args) if (U.length > 0)
{
auto result = to!S(args[0]);
Expand All @@ -3146,6 +3151,9 @@ unittest
assert(text(42, ' ', 1.5, ": xyz") == "42 1.5: xyz");
assert(wtext(42, ' ', 1.5, ": xyz") == "42 1.5: xyz"w);
assert(dtext(42, ' ', 1.5, ": xyz") == "42 1.5: xyz"d);
assert(text() is null);
assert(wtext() is null);
assert(dtext() is null);
}

/***************************************************************
Expand Down

0 comments on commit 4d59ddc

Please sign in to comment.