% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/survPenV2_04.r
\name{instr}
\alias{instr}
\title{Position of the nth occurrence of a string in another one}
\usage{
instr(str1, str2, startpos = 1, n = 1)
}
\arguments{
\item{str1}{main string in which str2 is to be found}

\item{str2}{substring contained in str1}

\item{startpos}{starting position in str1; default is 1}

\item{n}{which occurrence is to be found; default is 1}
}
\value{
number representing the nth position of str2 in str1
}
\description{
Returns the position of the nth occurrence of str2 in str1. Returns 0 if str2 is not found.
This code was first suggested by Abdelmonem Mahmoud Amer in https://stackoverflow.com/a/33005653/5421090
}
\examples{

library(survPen)

instr("character test to find the position of the third letter r","r",n=3)

}
