ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> ruby-talk
ruby-talk
Re: capitalize only when 4 or more letters are caps
by Dana Merrick other posts by this author
Jul 1 2008 12:58PM messages near this date
capitalize only when 4 or more letters are caps | Using hpricot to get tables
It's not really a complete solution, but you can work off of this:

string = "A BB CCC DDDD EEEE FFFFF"

result = string.split.inject([]) do |a,x|
   x.downcase! if x[/[A-Z]{4,}/]
   a << x
end
p result.join(" ") #=>  "A BB CCC dddd eeee fffff"


-- 
Dana Merrick - System Administrator
Integrated Computer Solutions, Inc.
54B Middlesex Tpke, Bedford, MA 01730
617.621.0060 x112 - http://www.ics.com
Thread:
Chris G.
Dana Merrick

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved