123456789101112131415161718192021222324252627282930313233343536 |
- #coding=utf-8
- class Formater():
- @staticmethod
- def formatStr(value):
- res = u''
- if value != None:
- try:
- res = str(value)
- except:
- pass
- return res
- @staticmethod
- def formatCount(value):
- return int(round(float(value or 0) * 100,0))
- @staticmethod
- def formatPrice(value):
- return int(round(float(value or 0) * 100,0))
- @staticmethod
- def formatCountShow(value):
- return '%.2f' % (float(value or 0)/100.0)
- @staticmethod
- def formatPriceShow(value):
- return '%.2f' % (float(value or 0)/100.0)
- @staticmethod
- def formatAmount(value):
- return int(round(float(value or 0) * 10000,0))
- @staticmethod
- def formatAmountShow(value):
- return '%.2f' % (float(value or 0) / 10000.0 + 0.0000001)
|