[nem-en] format strings in the sprint macro
Michal Moskal
michal.moskal at gmail.com
Sat Jan 7 13:12:59 CET 2006
Hi,
We (Kamil and I) were just discussing adding String.Format-like formatting
strings to the sprint macro (better known as $). A good overview of the
formatting strings is available at:
http://www.stevex.org/CS/blogs/dottext/articles/158.aspx
For example: string.Format ("foo{0,5:0.00}", 1) will return "foo 1.00".
The idea would be for $ "foo$(5:0.00, 1)" to return the same.
The problem is with syntax -- we thought it would be good to split at the
last comma (possibly excluding ones in parens). This could lead to
monsters like:
$"Ala has $(0:?#,##0.00;(?#,##0.00);Nothing,apple_count) apples".
Maybe other character, or other syntax would be better? What do you think?
--
Michal Moskal,
http://nemerle.org/~malekith/
More information about the devel-en
mailing list