R/str_locate_first.R

Defines functions str_locate_first

Documented in str_locate_first

#' extracts position of first character in the pattern within a string
#'
#' extracts position of first character in the pattern within a string
#' @param x is a string
#' @param pattern is a pattern
#' @keywords lists string nchar
#' @export
#' @examples
#' str_locate_first("12345$9.50 for Math and $11.90 for both subjects", pattern = '\\$')

str_locate_first <- function(x, pattern){
  stringr::str_locate_all(pattern = pattern, x)[[1]][ ,1]
}
Kidapt/keda documentation built on Nov. 23, 2019, 3:35 a.m.