# HG changeset patch # User Nicolas Saunier # Date 1440772755 14400 # Node ID fe71639f1ee7ddeaec0858edea2a5e9820c18d63 # Parent 5b91b8d97cf3f777fa9eb1eed3522ca9994eb914 merge and added function to up-/lower-case strings diff -r 5b91b8d97cf3 -r fe71639f1ee7 python/tests/utils.txt --- a/python/tests/utils.txt Fri Aug 28 10:38:08 2015 -0400 +++ b/python/tests/utils.txt Fri Aug 28 10:39:15 2015 -0400 @@ -1,6 +1,9 @@ >>> from utils import * >>> from moving import Point +>>> upperCaseFirstLetter('mmmm... donuts') +Mmmm... Donuts + >>> computeChi2([],[]) 0.0 >>> computeChi2(range(1,10),range(1,10)) diff -r 5b91b8d97cf3 -r fe71639f1ee7 python/utils.py --- a/python/utils.py Fri Aug 28 10:38:08 2015 -0400 +++ b/python/utils.py Fri Aug 28 10:39:15 2015 -0400 @@ -13,6 +13,15 @@ datetimeFormat = "%Y-%m-%d %H:%M:%S" ######################### +# Strings +######################### + +def upperCaseFirstLetter(s): + words = s.split(' ') + lowerWords = [w[0].upper()+w[1:].lower() for w in words] + return ' '.join(lowerWords) + +######################### # Enumerations #########################