diff options
author | Sam | 2013-05-23 00:22:54 +0000 |
---|---|---|
committer | Sam | 2013-05-23 00:22:54 +0000 |
commit | 7eb9f5d12389df0ef7440a82df0be9bd1119847e (patch) | |
tree | 3e81009fa50e1de0bdb10064695cb6179eb94be6 /wqflask/utility/formatting.py | |
parent | 66e8d76ea34b6784a451abe3223eb13107d4307f (diff) | |
download | genenetwork2-7eb9f5d12389df0ef7440a82df0be9bd1119847e.tar.gz |
Lots of changes around users
Diffstat (limited to 'wqflask/utility/formatting.py')
-rw-r--r-- | wqflask/utility/formatting.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/wqflask/utility/formatting.py b/wqflask/utility/formatting.py index 52173417..e53dda22 100644 --- a/wqflask/utility/formatting.py +++ b/wqflask/utility/formatting.py @@ -10,6 +10,14 @@ def numify(number, singular=None, plural=None): >>> numify(9, 'book', 'books') 'nine books' + You can add capitalize to change the capitalization + >>> numify(9, 'book', 'books').capitalize() + 'Nine books' + + Or capitalize every word using title + >>> numify(9, 'book', 'books').title() + 'Nine Books' + >>> numify(15) '15' @@ -107,3 +115,8 @@ def commify(n): if cents: out += '.' + cents return out + + +if __name__ == '__main__': + import doctest + doctest.testmod() |