/[gnue]/gnue-common/src/utils/TextUtils.py
ViewVC logotype

Diff of /gnue-common/src/utils/TextUtils.py

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

revision 1.10 by jcater, Sun Aug 10 17:59:04 2003 UTC revision 1.11 by jcater, Mon Sep 1 18:12:46 2003 UTC
# Line 148  _thirdDollarMap = ('', 'Thousand ', 'Mil Line 148  _thirdDollarMap = ('', 'Thousand ', 'Mil
148  # Comify a number  # Comify a number
149  # (e.g., print -9900 as -9,900.00)  # (e.g., print -9900 as -9,900.00)
150  def comify(num, decimals=2, parenthesis=0):  def comify(num, decimals=2, parenthesis=0):
151      neg = num < 0
152      num = abs(num)
153    whole, dec = (string.split(string.strip(("%%12.%sf" % decimals) % abs(num)),'.') + [""])[:2]    whole, dec = (string.split(string.strip(("%%12.%sf" % decimals) % abs(num)),'.') + [""])[:2]
154    if len(dec):    if len(dec):
155      dec = "." + dec      dec = "." + dec
# Line 163  def comify(num, decimals=2, parenthesis= Line 165  def comify(num, decimals=2, parenthesis=
165    while s[:1] == ',':    while s[:1] == ',':
166      s = s[1:]      s = s[1:]
167    
168    if num < 0:    if neg:
169      if parenthesis:      if parenthesis:
170        s = "(%s)" % s        s = "(%s)" % s
171      else:      else:

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

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