Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > capitalize only when 4 or more letters are caps

Reply
Thread Tools

capitalize only when 4 or more letters are caps

 
 
Chris G.
Guest
Posts: n/a
 
      07-01-2008
I have a chunk of text that could be sentences. If someone types in all
caps, I would like to use capitalize on just the words that are in all
caps. If I just use it on the entire object, my sentences get messed up
and don't start with a capital letter like they should.

I was wondering what an easy solution might be. I figured I could break
the string apart at the spaces to get the words easily enough, but what
about the conditional to only use capitalize on words with 4 or more
capital letters. That part has me stumped. I think I need a regular
expression for it, but I'm not sure what it should be.

Surely I am not the first person to want to do this.
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Keyboard CAPS LOCK only turns off with the shift key... BillyBob@nospam.com Computer Support 20 10-01-2013 08:44 PM
String#capitalize more complex Iñaki Baz Castillo Ruby 5 04-02-2009 06:29 PM
"capitalize" also letters after "-" ? Iñaki Baz Castillo Ruby 3 05-10-2008 03:48 PM
making all letters Caps/Small Letters Merrigan Python 4 12-14-2007 10:10 AM
Changing from capital letters to small letters using perl Venugopal Perl Misc 11 11-05-2003 06:07 PM



Advertisments