perlfaq4: How do I capitalize all the words on one line?

[email protected] (Iain Truskett)
Newsgroups perl.perlfaq.workers
Message-ID <[email protected]>
* Mention Damian's Autoformat module.

--- perlfaq4.pod~	2003-07-28 12:04:00.000000000 +1000
+++ perlfaq4.pod	2003-07-28 12:07:54.000000000 +1000
@@ -755,20 +755,33 @@ To force each word to be lower case, wit
 
 You can (and probably should) enable locale awareness of those
 characters by placing a C<use locale> pragma in your program.
 See L<perllocale> for endless details on locales.
 
 This is sometimes referred to as putting something into "title
 case", but that's not quite accurate.  Consider the proper
 capitalization of the movie I<Dr. Strangelove or: How I Learned to
 Stop Worrying and Love the Bomb>, for example.
 
+Damian Conway's L<Text::Autoformat> module provides some smart
+case transformations:
+
+    use Text::Autoformat;
+    my $x = "Dr. Strangelove or: How I Learned to Stop ".
+      "Worrying and Love the Bomb";
+
+    print $x, "\n";
+    for my $style (qw( sentence title highlight ))
+    {
+        print autoformat($x, { case => $style }), "\n";
+    }
+
 =head2 How can I split a [character] delimited string except when inside [character]?
 
 Several modules can handle this sort of pasing---Text::Balanced,
 Text::CVS, Text::CVS_XS, and Text::ParseWords, among others.
 
 Take the example case of trying to split a string that is
 comma-separated into its different fields. You can't use C<split(/,/)>
 because you shouldn't split if the comma is inside quotes.  For
 example, take a data line like this:


-- 
Iain.                                          <http://eh.org/~koschei/>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.