Learn R Programming

stringi (version 0.1-25)

stri_count: Count the Number of Pattern Matches in a String

Description

A convenience function. Calls either stri_count_regex, stri_count_fixed, or stri_count_charclass, depending on the argument used.

Usage

stri_count(str, ..., regex, fixed, charclass)

Arguments

str
character vector of strings to search in
...
additional arguments passed to the underlying functions
regex
character vector; regular expressions
fixed
character vector; fixed patterns
charclass
character vector; identifiers of character classes

Value

  • Returns an integer vector.

Details

Unless you are very lazy, please call the underlying functions directly for better performance.

See Also

Other search_count: stri_count_charclass; stri_count_fixed; stri_count_regex; stringi-search

Examples

Run this code
s <- "Lorem ipsum dolor sit amet, consectetur adipisicing elit."
stri_count(s, fixed=letters)
stri_count(s, regex="[[:alpha:]]")

Run the code above in your browser using DataLab