I need to do some case manipulation that I don't see in the documented
string functions.

I want to make sure that user input meets a certain capitalization
scheme, for example, if user input is a name, then the first letter of
each word in the name is upper case, and the rest are lower.

I know how to force the upper and lower cases with string.lower() and friends.

and I could even do a string.split() on the spaces in the names to
break the name into pieces.

I don't see an obvious way to do this.

what I've come up with so far is to do something like this.

break the name into pieces
force each piece to be lower case
replace the first letter in each word with a uppercase version of
whats there already.

Problems with this approach as I see them:
The built in split function will create undesirable results for names
that contain suffixes like Jr.  etc.
I'm not entirely sure how to replace the string with an uppercase
first letter on a per word basis.

Whats the "right" way to do something like this?

Thanks
Rance
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to