aboutsummaryrefslogtreecommitdiff
path: root/wqflask/utility
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask/utility')
-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()