#' 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]
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.