aboutsummaryrefslogtreecommitdiff
path: root/wqflask/utility/formatting.py
diff options
context:
space:
mode:
authorZachary Sloan2013-06-20 22:20:23 +0000
committerZachary Sloan2013-06-20 22:20:23 +0000
commit4ffee373494170e708678039dca132f1bd729ab1 (patch)
treea9d6054380f5a9d612a4d1d88889f68ea4923a75 /wqflask/utility/formatting.py
parent939058c4a3b668037974f2876b072c4be008da26 (diff)
parent52ac4b6e1c014801080cbbcad53df868058d2657 (diff)
downloadgenenetwork2-4ffee373494170e708678039dca132f1bd729ab1.tar.gz
Merge branch 'flask'
Diffstat (limited to 'wqflask/utility/formatting.py')
-rw-r--r--wqflask/utility/formatting.py13
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()