Author: spadkins
Date: Tue Jan 2 11:22:16 2007
New Revision: 8502
Modified:
p5ee/trunk/App-Widget/lib/App/Widget.pm
Log:
switch the order of sign and currency in format()
Modified: p5ee/trunk/App-Widget/lib/App/Widget.pm
==============================================================================
--- p5ee/trunk/App-Widget/lib/App/Widget.pm (original)
+++ p5ee/trunk/App-Widget/lib/App/Widget.pm Tue Jan 2 11:22:16 2007
@@ -538,14 +538,14 @@
# #,### integer. add commas as necessary.
# #,###.# float. 1 digit precision. add commas as necessary.
# $#,###.## currency. 2 digits precision. add commas as necessary.
- # $+#,###.## currency. 2 digits precision. add commas as necessary. add + sign at front if positive.
+ # +$#,###.## currency. 2 digits precision. add commas as necessary. add + sign at front if positive.
# ($#,###.##) currency. 2 digits precision. add commas as necessary. negatives in parentheses.
# (#) integer. negatives in parentheses.
# (#.###) float. 3 digits precision. negatives in parentheses.
- elsif ($format =~ /^(\(?)(\$?)(\+?)([#,]*)\.?(#*)(%?)[\)]*$/) {
+ elsif ($format =~ /^(\(?)(\+?)(\$?)([#,]*)\.?(#*)(%?)[\)]*$/) {
my $paren = $1;
- my $curr = $2;
- my $sign = $3;
+ my $sign = $2;
+ my $curr = $3;
my $int = $4;
my $frac = $5;
my $pct = $6;
@@ -573,12 +573,12 @@
}
}
}
- if ($curr) {
- $formatted_value = '$' . $formatted_value;
- }
if ($sign && $value > 0) {
$formatted_value = "+" . $formatted_value;
}
+ if ($curr) {
+ $formatted_value = '$' . $formatted_value;
+ }
if ($pct) {
$formatted_value = $formatted_value . "%";
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.