Skip to content
Prev 67406 / 398506 Next

How to change letters after space into capital letters

On Mon, 11 Apr 2005, Barry Rowlingson wrote:

            
[Example omitted, that did somthing different!
   c( "this is an element of the vector of strings", "second element" )
becomes:
   c( "This Is An Element Of The Vector Of Strings", "Second Element" )
]

Similarly, Gabor G is referring to a thread which answers a _different_ 
question.
But that is not what his example does, which capitalized the first word 
too.  I think he intended s/\b([a-z])/\u\1/g;

gannet% echo "this is a lower-cased string" | perl -p -e 's/\b([a-z])/\u\1/g'
This Is A Lower-Cased String
This is not actually to do with REs, but substitutions.  \u is not 
interpreted in substitutions (and only \1 to \9 are, as documented).
Yes. Use R-2.1.0 beta which has many bugs in gsub fixed.