/[gnue]/gnue-common/src/formatting/GDataFormatter.py
ViewVC logotype

Diff of /gnue-common/src/formatting/GDataFormatter.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11 by jamest, Mon Sep 15 19:02:50 2003 UTC revision 1.12 by jcater, Wed Oct 1 01:16:38 2003 UTC
# Line 66  def applyFormatting (value, mask): Line 66  def applyFormatting (value, mask):
66        fract = "%s" % value.frac()        fract = "%s" % value.frac()
67        fract = fract.split('.')[1]        fract = fract.split('.')[1]
68        whole = int(value)        whole = int(value)
69        wstr = str(whole)        wstr = str(abs(whole))
70    
71        if comma:        if comma:
72          commas, leading = divmod(len(wstr),3)          commas, leading = divmod(len(wstr),3)
# Line 80  def applyFormatting (value, mask): Line 80  def applyFormatting (value, mask):
80          for i in range(commas):          for i in range(commas):
81            rv += ',' + wstr[:3]            rv += ',' + wstr[:3]
82            wstr = wstr[3:]            wstr = wstr[3:]
83          
84        if dec:        if dec:
85          rv += ".%s" % fract          rv += ".%s" % fract
86          if whole < 0:
87            rv = '-' + rv
88        return rv        return rv
89    
90    return "%s" % value    return "%s" % value

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26