Commit f9967853 authored by Guido van Rossum's avatar Guido van Rossum

Use splitx() in capwords() (bugfix after interface change for split()).

Give capwords a default pattern argument which will recognize words as
sequeces of [a-zA-Z0-9_].
parent f1df7f55
......@@ -95,9 +95,9 @@ def intsplit(str, pat, maxsplit, retain):
# Capitalize words split using a pattern
def capwords(str, pat):
def capwords(str, pat='[^a-zA-Z0-9_]+'):
import string
words = split(str, pat, 1)
words = splitx(str, pat)
for i in range(0, len(words), 2):
words[i] = string.capitalize(words[i])
return string.joinfields(words, "")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment