Skip to content
Prev 279216 / 398506 Next

Counting the occurences of a charater within a string

On Thu, Dec 1, 2011 at 10:32 AM, Douglas Esneault
<Douglas.Esneault at mecglobal.com> wrote:
Here's an easy way from stringr:

library(stringr)
str_count( c("abc/def", "ghi/jkl/mno"), "/")
# [1] 1 2

Hadley
Message-ID: <CABdHhvGwt-fv_sEd-STazWxTmcWW8b78puWGpGLWEwWKDD2PKg@mail.gmail.com>
In-Reply-To: <974A7A659261804FA954D102472EA32E03D37A85@NYCEMBP01101.ad.insidemedia.net>