On 15-Sep-07 10:21:19, kevinchang wrote: > > Hi everyone, > > I am wondering if there is any built-in funcion that can > determine whether words in a character vector start with > a captial letter or not. Help, please. Thanks.
Something like: C<-c("Abc", "aBc", "abC") for(i in (1:length(C))){ if(length(grep("^[A-Z]",C[i]))>0){ print("Yes") else print("No") } } [1] "Yes" [1] "No" [1] "No" The "grep" expression "[A-Z]" looks for one of A,B,C,...,Z and the "^" makes it look for it at the start of the string. Hoping this helps, Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <[EMAIL PROTECTED]> Fax-to-email: +44 (0)870 094 0861 Date: 15-Sep-07 Time: 12:55:00 ------------------------------ XFMail ------------------------------ ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.