On 27/07/2011 1:48am, christian.posta wrote:
Forgive me if this might be more of a python-centric or text-handling
question more than Django, but it does come up within the context of
web development, processing user input, etc in all web frameworks
including django. I did a quick search on the forum and couldn't find
an answer. (I've also googled, but didn't turn up anything
useful....). Maybe someone can direct me to the answer...
For user input, I would like to format what they enter into 'sentence
case'
Example, if they input ALL CAPS for a description, I want to lowercase
that, but according to sentence rules (first word in sentence upper
case, rest lowercase up to the period).
I was hoping something like this exists as a convenience function/
module, but if not i guess i'll have to write it myself.
It isn't easy for English and I don't know about other languages. Long
ago I wrote such a thing for mailing addresses. If it is free text your
users are writing you have to deal with all sorts of stuff. I only had
to handle names like McTavish, O'Reilly and so on. Also I had to use an
array of known upper-case acronyms such as USA, GPO etc.
On the other hand, if you write it in Python from a test-driven
perspective it would become a very useful library.
I'd be super-keen to use it.
Mike
Thanks!
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.