 |
chamenas Wizard

Joined: 26 Mar 2008 Posts: 1547
|
Posted: Sun Jun 27, 2010 7:08 pm
3.21 BUG %format |
%format() with the argument "n", seems to be broken, as seen here:
| Code: |
<alias name="test_form" id="1534">
<value>#show %repeat("-", 17)
#show "|"%format(&-15 .0n, 20,000)"|"
#show %repeat("-", 17)
#show "|"%format( &-15 n, 20,000)"|"
#show %repeat("-", 17)</value>
</alias>
|
It cropped up in a script of mine where I noticed that:
%format( &-15 .0n, $_total_dam)
didn't work, but
%format( &-15 n, $_total_dam)
did. Can anyone confirm?
EDIT: changing to %format(&-15.0n, <number>) fixed it, but it worked with the space before 3.20 |
|
|
|
 |
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Sun Jun 27, 2010 7:36 pm |
I see no reason why it _should_ work with a space before the decimal. "&-15.0n" needs to be a single unit in order for it to work. That is true in other programming languages as well. I'm not sure where you got the idea that putting a space there was appropriate--nothing in the documentation suggests that it should be possible.
There are other problems with your code. For one, the first parameter of %format is supposed to be a string, so it should be within quotation marks, e.g. "&-15.0n". Second, you are using implicit concatenation again. The implicit concatenation is probably acceptable here, but you really ought to start using explicit concatenation.
| Code: |
| #show %concat("|",%format("&-15.0n", 20,000),"|") |
|
|
|
|
 |
chamenas Wizard

Joined: 26 Mar 2008 Posts: 1547
|
Posted: Sun Jun 27, 2010 7:43 pm |
It's actually explicit in the script. But here's the odd thing, in 2.37, when I tried %format(&-15.0n), it didn't work, that's why I put a space in the first place. It also didn't work when I surrounded it in quote marks, but that was with the space. Perhaps it will be different now.
|
|
|
|
 |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|