string <- "apple,banana, cat, doll and donkey; fish,goat"trimws(gsub("(^|\\p{P})\\s*(.)", "\\1 \\U\\2", string, perl=T))
Standard input is empty
[1] "Apple, Banana, Cat, Doll and donkey; Fish, Goat"
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!